Exemplo n.º 1
0
        public static void RegisterComponents()
        {
            var container = new UnityContainer();

            // register all your components with the container here
            // it is NOT necessary to register your controllers

            // e.g. container.RegisterType<ITestService, TestService>();
            container.RegisterType <MyAppDbContext>(new InjectionFactory(c => { return(MyAppDbContext.Create()); }));
            container.RegisterType <IAddressRepo, AddressRepo>();
            container.RegisterType <IContactRepo, ContactRepo>();

            GlobalConfiguration.Configuration.DependencyResolver = new UnityDependencyResolver(container);
        }