Esempio n. 1
0
        public DBMiddleware(RequestDelegate _next,
                            IInterfaceDAL interfaceDAL,
                            IFlowStepDAL flowStpeDAL,
                            IDbHelper dbHelp,
                            DBRouteValueDictionary _routeDict,
                            IConfiguration config)
        {
            this.next      = _next;
            this.dbHelp    = dbHelp;
            this.routeDict = _routeDict;

            SqlConnStr = config.GetConnectionString("SqlConnStr");

            //加载路由集合
            List <InterfaceModel> dtInterface = interfaceDAL.All();

            foreach (InterfaceModel model in dtInterface)
            {
                //加载步骤
                int              SN      = model.SN;
                string           Url     = model.Url;
                DBInterfaceModel dbInter = new DBInterfaceModel();
                dbInter.SerializeType = model.SerializeType;
                dbInter.Method        = model.Method;
                dbInter.Steps         = flowStpeDAL.Query(SN);
                dbInter.IsTransaction = model.IsTransaction;
                dbInter.ExecuteType   = model.ExecuteType;

                routeDict.Add(Url, dbInter);
            }
        }
Esempio n. 2
0
 public InterfaceController(IInterfaceDAL infterfaceDAL,
                            IFlowStepDAL flowStepDAL,
                            DBRouteValueDictionary _routeDict)
 {
     this.infterfaceDAL = infterfaceDAL;
     this.flowStepDAL   = flowStepDAL;
     this.routeDict     = _routeDict;
 }
Esempio n. 3
0
 public InterfaceBLL(IInterfaceDAL infterfaceDAL,
                     IParamDAL paramDAL,
                     IFlowStepDAL flowStepDAL)
 {
     this.infterfaceDAL = infterfaceDAL;
     this.paramDAL      = paramDAL;
     this.flowStepDAL   = flowStepDAL;
 }
Esempio n. 4
0
 public InterfaceController(IInterfaceDAL infterfaceDAL,
                            DBRouteValueDictionary _routeDict,
                            IInterfaceBLL interfaceBLL,
                            IConfiguration config)
 {
     this.infterfaceDAL = infterfaceDAL;
     this.routeDict     = _routeDict;
     this.interfaceBLL  = interfaceBLL;
     this.config        = config;
 }
Esempio n. 5
0
 public StepController(IInterfaceDAL interfaceDAL,
                       IFlowStepDAL flowStepDAL,
                       MyConfig myConfig,
                       IConfiguration configuration)
 {
     this.interfaceDAL  = interfaceDAL;
     this.flowStepDAL   = flowStepDAL;
     this.myConfig      = myConfig;
     this.configuration = configuration;
 }
Esempio n. 6
0
        public DBMiddleware(RequestDelegate _next,
                            IInterfaceDAL interfaceDAL,
                            IFlowStepDAL flowStepDAL,
                            IParamDAL paramDAL,
                            DBRouteValueDictionary _routeDict,
                            IConfiguration config,
                            MyConfig myConfig,
                            ILogger <DBMiddleware> logger,
                            IComponentContext componentContext)
        {
            this.next             = _next;
            this.paramDAL         = paramDAL;
            this.routeDict        = _routeDict;
            this.myConfig         = myConfig;
            this.logger           = logger;
            this.componentContext = componentContext;
            string SqlConnStr = config.GetConnectionString("ApiDocConnStr");

            //List<FilterCondition> filters = new List<FilterCondition>();
            //FilterCondition filter = new FilterCondition();
            //filter.BracketL = "(";
            //filter.BracketR = ")";
            //filter.ColumnName = "SN";
            //filter.Condition = ConditionTypeEnum.Equal;
            //filter.Value = "123";
            //filter.ValueType = "";
            //filter.JoinType = "And";
            //filters.Add(filter);

            //filter = new FilterCondition();
            //filter.BracketL = "(";
            //filter.BracketR = ")";
            //filter.ColumnName = "SN";
            //filter.Condition = ConditionTypeEnum.Equal;
            //filter.Value = "123";
            //filter.JoinType = "";
            //filters.Add(filter);

            //Dictionary<string, object> dist = new Dictionary<string, object>();
            //dist.Add("SN", 1);
            //dist.Add(_ReqFilter, filters);

            //string json = JsonConvert.SerializeObject(dist);

            //加载路由集合
            List <InterfaceModel> dtInterface = interfaceDAL.Query(false);

            foreach (InterfaceModel model in dtInterface)
            {
                //加载步骤
                int    SN  = model.SN;
                string Url = model.Url;
                model.Steps = flowStepDAL.QueryOfParam(SN);

                //接口参数
                string auth = "";
                foreach (ParamModel param in this.paramDAL.Query(SN))
                {
                    if (auth != "")
                    {
                        auth += "_";
                    }
                    auth += param.ParamName.Trim();
                }
                auth       = auth.ToLower();
                model.Auth = auth;

                if (!routeDict.ContainsKey(Url))
                {
                    routeDict.Add(Url, model);
                }
            }

            logger.LogInformation("加载接口完成,共" + dtInterface.Count.ToString());
        }