Пример #1
0
        private static void regeisterTypes(IUnityContainer container)
        {
            var appSettings = ConfigurationManager.AppSettings;

            ComponentLoader.LoadContainer(container, ".\\bin", appSettings["DataAccessLayerImplementation"]);
            ComponentLoader.LoadContainer(container, ".\\bin", appSettings["BusinessLayerImpelementation"]);
        }
Пример #2
0
        public static void Register(HttpConfiguration config)
        {
            // Web API configuration and services
            var container = new UnityContainer()
                            .AddNewExtension <Interception>();

            ComponentLoader.LoadContainer(container, ".\\bin", "Amaris.*.dll");
            config.DependencyResolver = new UnityResolver(container);
            // Web API configuration and services

            // Web API routes
            config.MapHttpAttributeRoutes();

            config.Routes.MapHttpRoute(
                name: "swagger_root",
                routeTemplate: "",
                defaults: null,
                constraints: null,
                handler: new RedirectHandler((message => message.RequestUri.ToString()), "swagger"));

            config.Routes.MapHttpRoute(
                name: "DefaultApi",
                routeTemplate: "api/{controller}/{id}",
                defaults: new { id = RouteParameter.Optional }
                );
        }
Пример #3
0
 public static void RegisterTypes(IUnityContainer container)
 {
     //Component initialization via MEF
     ComponentLoader.LoadContainer(container, ".\\bin", "WebApi.dll");
     ComponentLoader.LoadContainer(container, ".\\bin", "BusinessServices.dll");
     ComponentLoader.LoadContainer(container, ".\\bin", "DataModel.dll");
 }
Пример #4
0
 public static void RegisterTypes(IUnityContainer container)
 {
     //Component initialization via Managed Extensibility Framework (MEF)
     ComponentLoader.LoadContainer(container, ".\\bin", "VL.Web.Api.dll");
     ComponentLoader.LoadContainer(container, ".\\bin", "VL.Business.Services.dll");
     ComponentLoader.LoadContainer(container, ".\\bin", "VL.Data.Model.dll");
 }
Пример #5
0
 public static void RegisterTypes(IUnityContainer container)
 {
     //Component initialization via MEF
     ComponentLoader.LoadContainer(container, ".\\bin", "HPI.WebAPI.dll");
     ComponentLoader.LoadContainer(container, ".\\bin", "HPI.BusinessServices.dll");
     ComponentLoader.LoadContainer(container, ".\\bin", "HPI.DataAccessLayer.dll");
 }
Пример #6
0
 public static void RegisterTypes(IUnityContainer container)
 {
     //Component initialization via MEF
     ComponentLoader.LoadContainer(container, ".\\bin", "BookingTek.API.dll");
     ComponentLoader.LoadContainer(container, ".\\bin", "Service.dll");
     ComponentLoader.LoadContainer(container, ".\\bin", "DataModel.dll");
 }
Пример #7
0
 public static void RegisterTypes(IUnityContainer container)
 {
     //Component initialization via MEF
     ComponentLoader.LoadContainer(container, ".\\bin", "PFA.Hkt.UI.MVC.dll");
     ComponentLoader.LoadContainer(container, ".\\bin", "BusinessModel.dll");
     ComponentLoader.LoadContainer(container, ".\\bin", "DataModel.dll");
 }
        public static void Register(HttpConfiguration config)
        {
            // Web API configuration and services
            var container = new UnityContainer();

#if DEBUG
            ComponentLoader.LoadContainer(container, AppDomain.CurrentDomain.BaseDirectory + @"..\DocSystBusinessLogicImplementation\bin\Debug\", "*.dll");
            ComponentLoader.LoadContainer(container, AppDomain.CurrentDomain.BaseDirectory + @"..\DocSystDataAccessImplementation\bin\Debug\", "*.dll");
#else
            ComponentLoader.LoadContainer(container, ConfigurationManager.AppSettings["LogicAssemblyPath"], "*.dll");
#endif

            config.DependencyResolver = new UnityResolver(container);

            // Web API routes
            config.MapHttpAttributeRoutes();

            //Enable CORS
            var cors = new EnableCorsAttribute("*", "*", "GET, POST, PUT, DELETE, OPTIONS, HEAD");
            config.EnableCors(cors);

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

            // Controllers with Actions
        }
Пример #9
0
 public static void RegisterTypes(IUnityContainer container)
 {
     //Component initialization via MEF
     ComponentLoader.LoadContainer(container, ".\\bin", "refactor-me.dll");
     ComponentLoader.LoadContainer(container, ".\\bin", "BusinessAccessLayer.dll");
     ComponentLoader.LoadContainer(container, ".\\bin", "DataAccessLayer.dll");
 }
Пример #10
0
        public static IContainer Configure()
        {
            var builder = new ContainerBuilder();

            ComponentLoader.LoadContainer(builder, ".\\bin", "sapHowmuch.Api.Infrastructure.dll");
            ComponentLoader.LoadContainer(builder, ".\\bin", "sapHowmuch.Api.EventProcessors.dll");
            ComponentLoader.LoadContainer(builder, ".\\bin", "sapHowmuch.Api.Business.dll");
            ComponentLoader.LoadContainer(builder, ".\\bin", "sapHowmuch.Api.Repositories.dll");
            ComponentLoader.LoadContainer(builder, ".\\bin", "sapHowmuch.Api.Services.dll");

            builder.RegisterModule <AutofacWebTypesModule>();

            // for mvc5
            builder.RegisterControllers(typeof(Startup).Assembly)
            .OnActivating(e =>
            {
                var httpContext = e.Context.Resolve <HttpContextBase>();
                ((BaseMvcController)e.Instance).SetHttpContext(httpContext);
            })
            .PropertiesAutowired()
            .InstancePerLifetimeScope();

            // for web api
            builder.RegisterApiControllers(Assembly.GetExecutingAssembly())
            .PropertiesAutowired()
            .InstancePerLifetimeScope();

            var container = builder.Build();

            return(container);
        }
Пример #11
0
 public static void RegisterTypes(IKernel kernel)
 {
     //Component initialization via MEF
     ComponentLoader.LoadContainer(kernel, ".\\bin", "NInject.API*.dll");
     ComponentLoader.LoadContainer(kernel, ".\\bin", "NInject.Data*.dll");
     ComponentLoader.LoadContainer(kernel, ".\\bin", "NInject.Services*.dll");
     // ComponentLoader.LoadContainer(kernel, ".\\bin", "BusinessServices.dll");
 }
Пример #12
0
        public static IUnityContainer BuildUnityContainer()
        {
            var container = new UnityContainer();

            ComponentLoader.LoadContainer(container, ".\\bin", "DataAccess.dll");
            ComponentLoader.LoadContainer(container, ".\\bin", "Utilities.dll");
            ComponentLoader.LoadContainer(container, ".\\bin", "Services.dll");
            return(container);
        }
Пример #13
0
        public static void RegisterTypes(IUnityContainer container)
        {
            //Component initialization via MEF
            ComponentLoader.LoadContainer(container, ".\\bin", "MC.ClientPortal.WebApi.dll");
            ComponentLoader.LoadContainer(container, ".\\bin", "MC.BusinessServices.dll");


            //  container.RegisterType<AccountController>(new InjectionConstructor());
        }
Пример #14
0
        public static void Initialise()
        {
            IUnityContainer   container = new UnityContainer();
            RegisterComponent register  = new RegisterComponent(container);

            ServiceLocator.SetLocatorProvider(() => new UnityServiceLocator(container));

            ComponentLoader.LoadContainer(register,
                                          Assembly.GetExecutingAssembly(),
                                          Assembly.GetAssembly(typeof(IGraphStorageService)));
        }
Пример #15
0
        /// <summary>Registers the type mappings with the Unity container.</summary>
        /// <param name="container">The unity container to configure.</param>
        /// <remarks>There is no need to register concrete types such as controllers or API controllers (unless you want to
        /// change the defaults), as Unity allows resolving a concrete type even if it was not previously registered.</remarks>
        public static void RegisterTypes(IUnityContainer container)
        {
            // NOTE: To load from web.config uncomment the line below. Make sure to add a Microsoft.Practices.Unity.Configuration to the using statements.
            // container.LoadConfiguration();

            // TODO: Register your types here
            // container.RegisterType<IProductRepository, ProductRepository>();
            //container.RegisterType<IOUMemberServices, OUMemberServices>().RegisterType<UnitOfWork>(new HierarchicalLifetimeManager());
            ComponentLoader.LoadContainer(container, ".\\bin", "WebApi.dll");
            ComponentLoader.LoadContainer(container, ".\\bin", "BusinessServices.dll");
        }
Пример #16
0
        private static IUnityContainer BuildUnityContainer()
        {
            var container = new UnityContainer();

            // register all your components with the container here
            // e.g. container.RegisterType<ITestService, TestService>();

            ComponentLoader.LoadContainer(container, ".\\bin", "RestaurantManagementSystemAPI.dll");
            ComponentLoader.LoadContainer(container, ".\\bin", "BusinessServices.dll");

            return(container);
        }
Пример #17
0
        public static void Initialise()
        {
            IUnityContainer   container = new UnityContainer();
            RegisterComponent register  = new RegisterComponent(container);

            ServiceLocator.SetLocatorProvider(() => new UnityServiceLocator(container));

            ComponentLoader.LoadContainer(register,
                                          Assembly.GetExecutingAssembly(),
                                          Assembly.GetAssembly(typeof(ModelDependencyResolver)),
                                          Assembly.GetAssembly(typeof(DomainDependencyResolver)));
        }
Пример #18
0
        public static void Register(HttpConfiguration config)
        {
            config.MessageHandlers.Add(new OptionMethodHandler());

            //Reduces data transfer overload over 30%
            config.Formatters.JsonFormatter.SerializerSettings.NullValueHandling = NullValueHandling.Ignore;

            // Web API configuration and services
            config.Services.Replace(typeof(IExceptionHandler), new CustomExceptionHandler());

            // Web API routes
            config.MapHttpAttributeRoutes();

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

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

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

            var container = new UnityContainer();

            ComponentLoader.LoadContainer(container, "./bin/", "Backeame.*.dll");
            //var cors = new System.Web.Http.Cors.EnableCorsAttribute("*","*","*");//http://172.20.10.4:4200

            //config.EnableCors(cors);

            config.DependencyResolver = new UnityDependencyResolver(container);
        }
Пример #19
0
        public static void RegisterComponents()
        {
            var container = new UnityContainer();

            // Note: All the dependencies have been specified as IComponent to MEF by respective projects.
            // Hence no need to register any types here.
            // Instead we specify the various assemblies which contain the Components required to resolve the dependencies or inject them.
            ComponentLoader.LoadContainer(container, ".\\bin", "Api.BusinessEntities.dll");
            ComponentLoader.LoadContainer(container, ".\\bin", "Api.BusinessService.dll");
            ComponentLoader.LoadContainer(container, ".\\bin", "Api.Data.dll");

            GlobalConfiguration.Configuration.DependencyResolver = new UnityDependencyResolver(container);
        }
Пример #20
0
        public static void RegisterComponents()
        {
            var container = new UnityContainer();

            ComponentLoader.LoadContainer(container, ".\\bin", "PetVacay.*.dll");

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

            // e.g. container.RegisterType<ITestService, TestService>();

            GlobalConfiguration.Configuration.DependencyResolver = new UnityResolver(container);
        }
Пример #21
0
 private static void RegisterTypes(UnityContainer container)
 {
     // Component initialization via MEF
     // 현재는 문자열로 등록되게 했기 때문에, 프로젝트 이름이 변경되면 Regex를 써도 된다.
     // 2016-04-28
     // MEF를 도입함으로서 아키텍쳐적으로 여러가지 이점을 챙길수 있다.
     // 1. 확장성과 loosely coupled 한 api 를 가질수 있게 된다.
     // 2. 리플렉션을 이용한 api 등록이므로, runtime 상에서 자동적으로 로딩할 수 있다. (공통의 suffix를 통해서...)
     // 3. Database transaction 등이 서비스에 노출되지 않으므로 구조적으로 보안상의 위험을 줄일수 있다.
     ComponentLoader.LoadContainer(container, ".\\bin", "WebApi.dll");             // WebApi 프로젝트에서 등록
     ComponentLoader.LoadContainer(container, ".\\bin", "BusinessServices.dll");   // BusinessServices 프로젝트에서 등록
     ComponentLoader.LoadContainer(container, ".\\bin", "DataModel.dll");          // BusinessServices 프로젝트에서 등록
 }
Пример #22
0
        public static void Register(HttpConfiguration config)
        {
            var container = new UnityContainer();

            config.EnableCors();
            ComponentLoader.LoadContainer(container, ".\\bin", "ESport.*.dll");

            config.DependencyResolver = new UnityResolver(container);
            config.MapHttpAttributeRoutes();

            config.Routes.MapHttpRoute(
                name: "DefaultApi",
                routeTemplate: "api/{controller}/{id}",
                defaults: new { id = RouteParameter.Optional }
                );
        }
Пример #23
0
        public static void Register(HttpConfiguration config)
        {
            var container = new UnityContainer();

            ComponentLoader.LoadContainer(container, ".\\bin", "Tresana.*.dll");

            GlobalConfiguration.Configuration.DependencyResolver = new Unity.WebApi.UnityDependencyResolver(container);
            // Web API routes
            config.MapHttpAttributeRoutes();

            config.Routes.MapHttpRoute(
                name: "DefaultApi",
                routeTemplate: "api/{controller}/{id}",
                defaults: new { id = RouteParameter.Optional }
                );
        }
Пример #24
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

            //AT: This is registration if not using MEF
            // e.g. container.RegisterType<ITestService, TestService>();
            //container.RegisterType<IEventServices, EventServices>().RegisterType<UnitOfWork>(new HierarchicalLifetimeManager()); ;

            //AT: Registration if using MEF
            ComponentLoader.LoadContainer(container, ".\\bin", "EventTrackerAPI.dll");
            ComponentLoader.LoadContainer(container, ".\\bin", "EventTracker.*.dll");

            GlobalConfiguration.Configuration.DependencyResolver = new UnityDependencyResolver(container);
        }
Пример #25
0
        public static void Register(HttpConfiguration config)
        {
            // Configuración y servicios de API web
            var container = new UnityContainer();

            ComponentLoader.LoadContainer(container, ".\\bin", "Lupi.*.dll");

            config.DependencyResolver = new UnityResolver(container);

            // Rutas de API web
            config.MapHttpAttributeRoutes();

            config.Routes.MapHttpRoute(
                name: "DefaultApi",
                routeTemplate: "api/{controller}/{id}",
                defaults: new { id = RouteParameter.Optional }
                );
        }
Пример #26
0
        public static void Register(HttpConfiguration config)
        {
            var container = new UnityContainer();


            //Para que esto funcione, tienen que copiar y pegar los dll de Tresana.Data.Access.dll,
            //Tresana.Data.Repository.dll y Tresana.Web.Services.dll en la carpeta bin de Tresana.Web.Api.
            //Como cortamos las referencias, sino no puede cargar el assembly.
            //La otra opción es modificar el path para que reconozca la carpeta correspondientes.
            ComponentLoader.LoadContainer(container, ".\\bin", "Tresana.*.dll");

            GlobalConfiguration.Configuration.DependencyResolver = new Unity.WebApi.UnityDependencyResolver(container);
            // Web API routes
            config.MapHttpAttributeRoutes();

            config.Routes.MapHttpRoute(
                name: "DefaultApi",
                routeTemplate: "api/{controller}/{id}",
                defaults: new { id = RouteParameter.Optional }
                );
        }
Пример #27
0
 public static void RegisterTypes(IUnityContainer container)
 {
     //Component initialization via MEF
     ComponentLoader.LoadContainer(container, ".\\bin", "GestionParametros.dll");
     ComponentLoader.LoadContainer(container, ".\\bin", "BusinessServices.dll");
 }
Пример #28
0
 public static void RegisterTypes(IUnityContainer container)
 {
     ComponentLoader.LoadContainer(container, ".\\", "EuroFinService.dll");
 }
Пример #29
0
 public static void RegisterTypes(IUnityContainer container)
 {
     //Component initialization via MEF
     ComponentLoader.LoadContainer(container, ".\\bin", "WebApp.dll");
     ComponentLoader.LoadContainer(container, ".\\bin", "WebService.dll");
 }
Пример #30
0
 public static void RegisterTypes(IUnityContainer container)
 {
     //Component initialization via MEF
     ComponentLoader.LoadContainer(container, ".\\bin", "ProjectManager.WebAPI.dll");
     ComponentLoader.LoadContainer(container, ".\\bin", "ProjectManager.BL.dll");
 }