Exemple #1
0
        public static void Register(HttpConfiguration config)
        {
            // Web API configuration and services

            // Web API routes
            //config.MapHttpAttributeRoutes();

            //config.Routes.MapHttpRoute(
            //    name: "DefaultApi",
            //    routeTemplate: "api/{controller}/{id}",
            //    defaults: new { id = RouteParameter.Optional }
            //);

            // OData

            config.MapODataServiceRoute("ODataRoute", null, GetEdmModelChinookConvention());

            config.Filters.Add(new EnableQueryAttribute()
            {
                PageSize = 100 // !!!
            });

            // Unity

            var container = new UnityContainer();

            UnityHelperChinook.RegisterMappings(container);

            UnityHelperAuditTrail.RegisterMappings(container);
            UnityHelperLog.RegisterMappings(container);

            config.DependencyResolver = new UnityResolver(container);
        }
        public void RegisterMappings(UnityContainer container)
        {
            UnityHelperChinook.RegisterMappings(container);

            UnityHelperAuditTrail.RegisterMappings(container);
            UnityHelperLog.RegisterMappings(container);
            UnityHelperSecurity.RegisterMappings(container);
        }
        public static void RegisterMappings()
        {
            var container = new UnityContainer();

            UnityHelperNorthwind.RegisterMappings(container);

            UnityHelperAuditTrail.RegisterMappings(container);
            UnityHelperLog.RegisterMappings(container);
            UnityHelperSecurity.RegisterMappings(container);

            // Account

            container.RegisterType <AccountController>(new InjectionConstructor());
            //container.RegisterType<ManageController>(new InjectionConstructor());
            //container.RegisterType<RolesAdminController>(new InjectionConstructor());
            //container.RegisterType<UsersAdminController>(new InjectionConstructor());

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