示例#1
0
        private static void RegisterEarthOnlineEntities(IUnityContainer container)
        {
            var earthSettings = ConfigReader <string> .GetSetting("EarthOnlineEntities") ?? string.Empty;

            var manager     = new PerRequestLifetimeManager();
            var constructor = new InjectionConstructor(earthSettings);

            container.RegisterType <EarthOnlineEntities>(manager, constructor);
        }
示例#2
0
        /// <summary>
        /// Creates an instance of UnityContainer and registers the instances which needs to be injected
        /// to Controllers/Views/Services, etc.
        /// </summary>
        private static void RegisterUnityContainer()
        {
            _container = new UnityContainer();
            var earthSettings = ConfigReader <string> .GetSetting("EarthOnlineEntities");

            var manager     = new PerRequestLifetimeManager();
            var constructor = new InjectionConstructor(earthSettings);

            _container.RegisterType <EarthOnlineEntities>(manager, constructor);

            RegisterRepositories(_container);
            RegisterServices(_container);

            DependencyResolver.SetResolver(new UnityDependencyResolver(_container));
        }