Created
April 27, 2021 17:15
-
-
Save manoj-choudhari-git/7e341e22a135a05229f6c13b4422c181 to your computer and use it in GitHub Desktop.
Startup configurations - LazyInstance should be resolved when Lazy is asked
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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