示例#1
0
        static IFactory GetFactory(IInjector injector)
        {
            injector.RegisterSingleton(() => new Service1
            {
                ServiceInfo = "This is service 1 at start"
            });
            injector.RegisterScoped(() => new Service2()
            {
                ServiceInfo = "This is service 2 at start"
            });
            injector.RegisterScoped(() => new Service3()
            {
                ServiceInfo = "This is service 3 at start"
            });
            injector.RegisterScoped <DIClass>();
            injector.RegisterScoped <DIClass2>();
            injector.RegisterScoped <DIClass3>();
            injector.RegisterScoped <DIClass4>();

            return(injector.GetFactory());
        }