Skip to content

Instantly share code, notes, and snippets.

@dmitry-zaets
Created May 17, 2017 11:32
Show Gist options
  • Save dmitry-zaets/d4f3dee6a6e20832026ef3a23d03f3fd to your computer and use it in GitHub Desktop.
Save dmitry-zaets/d4f3dee6a6e20832026ef3a23d03f3fd to your computer and use it in GitHub Desktop.
public static void RegisterOptions(this ContainerBuilder builder)
{
builder.RegisterGeneric(typeof(OptionsManager<>))
.As(typeof(IOptions<>))
.SingleInstance();
builder.RegisterGeneric(typeof(OptionsMonitor<>))
.As(typeof(IOptionsMonitor<>))
.SingleInstance();
builder.RegisterGeneric(typeof(OptionsSnapshot<>))
.As(typeof(IOptionsSnapshot<>))
.InstancePerLifetimeScope();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment