예제 #1
0
 public BaseService(IServicePack servicePack)
 {
     PDBSM     = servicePack.PersonalDBShardManager;
     Common1DB = servicePack.Common1DBContext;
     Common2DB = servicePack.Common2DBContext;
     Common3DB = servicePack.Common3DBContext;
 }
예제 #2
0
        public async Task InvokeAsync(HttpContext context,
                                      IServicePack servicePack,
                                      Common1DBContext common1DBContext,
                                      Common2DBContext common2DBContext,
                                      Common3DBContext common3DBContext,
                                      PersonalDBShardManager.PersonalShard001 personalShard001,
                                      PersonalDBShardManager.PersonalShard002 personalShard002,
                                      PersonalDBShardManager.PersonalShard003 personalShard003,
                                      PersonalDBShardManager.PersonalShard004 personalShard004,
                                      PersonalDBShardManager.PersonalShard005 personalShard005,
                                      PersonalDBShardManager.PersonalShard006 personalShard006,
                                      PersonalDBShardManager.PersonalShard007 personalShard007,
                                      PersonalDBShardManager.PersonalShard008 personalShard008,
                                      ILogObj logObj)
        {
            //masterdata
            servicePack.MasterData = MasterDataLoader.LatestMasterData;

            //db context
            servicePack.Common1DBContext       = common1DBContext;
            servicePack.Common2DBContext       = common2DBContext;
            servicePack.Common3DBContext       = common3DBContext;
            servicePack.PersonalDBShardManager = new PersonalDBShardManager(
                personalShard001,
                personalShard002,
                personalShard003,
                personalShard004,
                personalShard005,
                personalShard006,
                personalShard007,
                personalShard008
                );

            //log
            servicePack.Log = logObj;


            var path = context.Request.Path.ToString();

            if (path.StartsWith("/api/"))
            {
                path = path.Substring("/api/".Length);
                path = path.Replace('/', '_').ToLower();

                ProtocolModels.ProtocolCode protocolcode;
                if (!Enum.TryParse(path, out protocolcode))
                {
                    context.Response.StatusCode = (int)HttpStatusCode.Gone;
                    return;
                }

                servicePack.ProtocolCode = protocolcode;
            }

            await _next(context);

            Logger.Logging(logObj);
        }
예제 #3
0
        public async Task InvokeAsync(HttpContext context,
                                      IServicePack servicePack,
                                      Common1DBContext common1DBContext,
                                      Common2DBContext common2DBContext,
                                      Common3DBContext common3DBContext,
                                      PersonalDBShardManager.PersonalShard001 personalShard001,
                                      PersonalDBShardManager.PersonalShard002 personalShard002,
                                      PersonalDBShardManager.PersonalShard003 personalShard003,
                                      PersonalDBShardManager.PersonalShard004 personalShard004,
                                      PersonalDBShardManager.PersonalShard005 personalShard005,
                                      PersonalDBShardManager.PersonalShard006 personalShard006,
                                      PersonalDBShardManager.PersonalShard007 personalShard007,
                                      PersonalDBShardManager.PersonalShard008 personalShard008,
                                      ILogObj logObj)
        {
            servicePack.Common1DBContext       = common1DBContext;
            servicePack.Common2DBContext       = common2DBContext;
            servicePack.Common3DBContext       = common3DBContext;
            servicePack.PersonalDBShardManager = new PersonalDBShardManager(
                personalShard001,
                personalShard002,
                personalShard003,
                personalShard004,
                personalShard005,
                personalShard006,
                personalShard007,
                personalShard008
                );

            //log
            servicePack.Log = logObj;

            await _next(context);

            Logger.Logging(logObj);
        }