Example #1
0
        // 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();
            // Add MyIoc container to its custom controller factory and add to services.
            MyIoc container = new MyIoc();

            container.Register <ILocator, LDAPLocator>();
            container.Register <IRealm, LDAPRealm>();
            MyIocControllerFactory ctrlFact = new MyIocControllerFactory(container);

            ctrlFact.RegisterController <HomeController>("HomeController");
            services.AddSingleton <IControllerFactory>(ctrlFact);
        }
Example #2
0
        public static MyIoc GetDataFlow <TStep1, TStep2, TStep3>(TimeSpan reQueueTimeOut)
        {
            var result = new MyIoc();

            var queue            = new DataFlowQueueInMemory();
            var dataFlowSettings = new DataFlowTestSettings
            {
                RequeueTimeOut = reQueueTimeOut
            };

            var dataFlow = new MyDataFlow <TStep1, TStep2, TStep3>(queue, dataFlowSettings);

            dataFlow.RegisterJsonSerializer();

            result.Register(dataFlow);
            result.Register <MyDataFlowBase>(dataFlow);

            return(result);
        }
Example #3
0
        public void RegisteredTypesShouldExist()
        {
            //Register a type and verity that it is available in the container
            myIoc.Register <IExistent, ExistentImpl>();
            //Verify that the container has the type we registered
            bool exists = myIoc.Exists <IExistent>();

            Assert.True(exists);
        }
Example #4
0
 public void RegisterController <C>(String controllerName)
 {
     container.Register <C, C>();
     controllers.Add(controllerName,
                     new ResolvableController <C>(this.container));
 }