Skip to content

Instantly share code, notes, and snippets.

@manoj-choudhari-git
Created April 27, 2021 17:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save manoj-choudhari-git/7e341e22a135a05229f6c13b4422c181 to your computer and use it in GitHub Desktop.
Save manoj-choudhari-git/7e341e22a135a05229f6c13b4422c181 to your computer and use it in GitHub Desktop.
Startup configurations - LazyInstance should be resolved when Lazy is asked
public class Startup
{
// some other code...
// ConfigureService method showing DI configurations
public void ConfigureServices(IServiceCollection services)
{
services.AddTransient(typeof(Lazy<>), typeof(LazyInstance<>));
services.AddSingleton<ICreatedOnDateTimeService, CreatedOnDateTimeService>();
services.AddControllersWithViews();
}
// some other code...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment