RegisterConnection() публичный Метод

public RegisterConnection ( string namedConnection, OrmLiteConnectionFactory connectionFactory ) : void
namedConnection string
connectionFactory OrmLiteConnectionFactory
Результат void
Пример #1
0
        public override void Configure(Container container)
        {
            //ServiceStack.Text.JsConfig.EmitCamelCaseNames = true; ! DO NOT USE THIS !
            //Feature disableFeatures = Feature.Xml | Feature.Jsv | Feature.Csv | Feature.Soap11 | Feature.Soap12 | Feature.Soap;
            SetConfig(new EndpointHostConfig
            {
                DebugMode = false,
                UseCustomMetadataTemplates = true,
                //DefaultContentType = ContentType.Json,
																//GlobalResponseHeaders = {
                //    { "Access-Control-Allow-Origin", "*" },
                //    { "Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS" },
                //    { "Access-Control-Allow-Headers", "Content-Type, Signature" }
                //},
                EnableFeatures = Feature.Json | Feature.Metadata
                //ServiceStackHandlerFactoryPath  = "api"                
            });
            CorsFeature cf = new CorsFeature(allowedOrigins: "*", allowedMethods: "GET, POST, PUT, DELETE, OPTIONS", allowedHeaders: "Content-Type, Signature", allowCredentials: false);
            this.Plugins.Add(cf);
            this.Plugins.Add(new SwaggerFeature());
            //DB
												var dbConnectionFactory = new OrmLiteConnectionFactory(GetConnectionString("Freight"), SqlServerDialect.Provider)
            {
                ConnectionFilter =
                    x =>
                    new ProfiledDbConnection(x, Profiler.Current)
            };
												dbConnectionFactory.RegisterConnection("TMS", GetConnectionString("TMS"), SqlServerDialect.Provider);
												dbConnectionFactory.RegisterConnection("WMS", GetConnectionString("WMS"), SqlServerDialect.Provider);
            container.Register<IDbConnectionFactory>(dbConnectionFactory);
												//
            var secretKey = new WebApi.ServiceModel.SecretKeyFactory(strSecretKey);
            container.Register<WebApi.ServiceModel.ISecretKey>(secretKey);
            //Auth
            container.RegisterAutoWired<WebApi.ServiceModel.Auth>();
            //WMS
												container.RegisterAutoWired<WebApi.ServiceModel.Wms.Wms_Login_Logic>();
												container.RegisterAutoWired<WebApi.ServiceModel.Wms.List_Rcbp1_Logic>();
            container.RegisterAutoWired<WebApi.ServiceModel.Wms.List_Imgr1_Logic>();
            container.RegisterAutoWired<WebApi.ServiceModel.Wms.List_Impr1_Logic>();
            container.RegisterAutoWired<WebApi.ServiceModel.Wms.List_Imgr2_Logic>();
            container.RegisterAutoWired<WebApi.ServiceModel.Wms.List_Imgi1_Logic>();
            container.RegisterAutoWired<WebApi.ServiceModel.Wms.List_Imgi2_Logic>();
            container.RegisterAutoWired<WebApi.ServiceModel.Wms.List_Imsn1_Logic>();
            container.RegisterAutoWired<WebApi.ServiceModel.Wms.Confirm_Imgr1_Logic>();
												//TMS
												container.RegisterAutoWired<WebApi.ServiceModel.Tms.Jmjm_Logic>();
												container.RegisterAutoWired<WebApi.ServiceModel.Tms.Sibl_Logic>();
            //Event
            container.RegisterAutoWired<WebApi.ServiceModel.Event.Event_Login_Logic>();
            container.RegisterAutoWired<WebApi.ServiceModel.Event.List_Jmjm6_Logic>();
            container.RegisterAutoWired<WebApi.ServiceModel.Event.List_JobNo_Logic>();
            container.RegisterAutoWired<WebApi.ServiceModel.Event.Update_Done_Logic>();
            container.RegisterAutoWired<WebApi.ServiceModel.Event.List_Container_Logic>();
            //Freight
												container.RegisterAutoWired<WebApi.ServiceModel.Freight.Freight_Login_Logic>();
												container.RegisterAutoWired<WebApi.ServiceModel.Freight.Saus_Logic>();
												container.RegisterAutoWired<WebApi.ServiceModel.Freight.Rcbp_Logic>();
												container.RegisterAutoWired<WebApi.ServiceModel.Freight.Smsa_Logic>();
												container.RegisterAutoWired<WebApi.ServiceModel.Freight.Smct_Logic>();
												container.RegisterAutoWired<WebApi.ServiceModel.Freight.Plvi_Logic>();
            container.RegisterAutoWired<WebApi.ServiceModel.Freight.Rcvy_Logic>();
												container.RegisterAutoWired<WebApi.ServiceModel.Freight.Tracking_Logic>();
												container.RegisterAutoWired<WebApi.ServiceModel.Freight.ViewPDF_Logic>();
        }