Skip to content

Instantly share code, notes, and snippets.

@dmitry-zaets
Created May 17, 2017 11:29
Show Gist options
  • Save dmitry-zaets/d711ac8f3d6d193c6a9bbe3ef6bdf985 to your computer and use it in GitHub Desktop.
Save dmitry-zaets/d711ac8f3d6d193c6a9bbe3ef6bdf985 to your computer and use it in GitHub Desktop.
public static void Configure<TOptions>(this ContainerBuilder builder, Action<TOptions> configureOptions) where TOptions : class
{
if (builder == null)
{
throw new ArgumentNullException(nameof(builder));
}
if (configureOptions == null)
{
throw new ArgumentNullException(nameof(configureOptions));
}
builder.RegisterInstance(new ConfigureOptions<TOptions>(configureOptions))
.As<IConfigureOptions<TOptions>>()
.SingleInstance();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment