// This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);

            RegisterLayer(services, new IocRegisterDto()
            {
                RegisterInterface  = typeof(IQueryOrderRepository),
                RegisterClass      = typeof(QueryOrderRepository),
                ClassNamespace     = "RA.Persistence.Mssql.Repositories.",
                InterfaceNamespace = "RA.Persistence.Interfaces.",
            }, CQRS_TYPE.None);

            RegisterLayer(services, new IocRegisterDto()
            {
                RegisterInterface  = typeof(IOrderBusinessService),
                RegisterClass      = typeof(OrderBusinessService),
                ClassNamespace     = "RA.BusinessService.BusinessServices.",
                InterfaceNamespace = "RA.BusinessService.Interfaces.",
            }, CQRS_TYPE.None);

            var assembly     = Assembly.GetExecutingAssembly();
            var resourceName = "RA.Api..connstr";

            using (Stream stream = assembly.GetManifestResourceStream(resourceName))
                using (StreamReader reader = new StreamReader(stream))
                {
                    var connection = reader.ReadToEnd();
                    services.AddDbContext <MyDbContext>(options => options.UseSqlServer(connection));
                }

            services.AddSingleton(typeof(IMapper), MappingFactory.GetMapper());
        }
 public void Install(IWindsorContainer container, IConfigurationStore store)
 {
     container.Register(
         Component.For <IMapper>()
         .UsingFactoryMethod(x => MappingFactory.GetMapper())
         .LifestyleSingleton()
         );
 }
 public static T Resolve <T>()
 {
     if (_container == null)
     {
         _container = new UnityContainer();
         _container.AddNewExtension <Interception>();
         _container.RegisterInstance(MappingFactory.GetMapper());
         _container.RegisterType <IUserWindowsConnector, UserWindowsConnector>(
             new Interceptor <InterfaceInterceptor>(),
             new InterceptionBehavior <ConnectorInterceptor>()
             );
     }
     return(_container.Resolve <T>());
 }