Tutorial by Examples

public interface ISingleton : IDisposable { } public class TransientDependency { } public class Singleton : ISingleton { public void Dispose() { } } public class CompositionRoot : IDisposable, IHttpControllerActivator { private readonly ISingleton _singleton; // pass in a...

MVC

public interface ISingleton : IDisposable { } public class TransientDependency { } public class Singleton : ISingleton { public void Dispose() { } } public class CompositionRoot : IDisposable, IControllerFactory { private readonly ISingleton _singleton; // pass in any tru...
in Startup.cs // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { // Add framework services. services.AddMvc(); var controllerActivator = new CompositionRoot(); services...

Page 1 of 1