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); } }
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()); }