protected override DataCollection ConvertDataCollection(ref object obj) { var rtn = new GoBusiData(); if (obj is GoData) { var gd = (GoData)obj; rtn.WebData = gd; } return(rtn); }
protected override void DoProcess(GoBusiParameter p, GoBusiData d) { lock (lockobj) { if (!_method.ContainsKey(this.Name)) { _method.Add(this.Name, new Dictionary <string, MethodInfo>()); } if (_method[this.Name].Count <= 0) { var t = this.GetType(); var methods = t.GetMethods(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance); foreach (var m in methods) { var parray = m.GetParameters(); if (parray.Length == 1 && (parray[0].ParameterType.FullName == typeof(LogicData).FullName)) { _method[this.Name].Add(m.Name.ToLower(), m); } } } } LogicData ld = new LogicData(); //添加querystring foreach (var s in p.WebParam.Domain(DomainKey.QUERY_STRING)) { ld.SetValue(s.Key, s.Value); } //添加postback数据 foreach (var s in p.WebParam.Domain(DomainKey.POST_DATA)) { ld.SetValue(s.Key, s.Value); } //添加上传的文件 foreach (var s in p.WebParam.Domain(DomainKey.UPDATE_FILE)) { ld.SetValue(s.Key, s.Value); } //传入的参数 foreach (var s in p.WebParam.Domain(DomainKey.INPUT_PARAMETER)) { ld.SetValue(s.Key, s.Value); } //自定义的参数 foreach (var s in p.WebParam.Domain(DomainKey.CUSTOMER_PARAMETER)) { ld.SetValue(s.Key, s.Value); } object result = null; p.CallAction = p.CallAction == "" ? "load" : p.CallAction; if (_method[Name].ContainsKey(p.CallAction.ToLower())) { if (!ExposedObjectHelper.TryInvoke(_method[Name][p.CallAction.ToLower()], this, new object[] { ld }, out result, true)) { throw new Exception($"方法{Name}.{p.CallAction}执行失败"); } } else { GlobalCommon.Logger.WriteLog(LoggerLevel.ERROR, $"{Name}的Logic缺少名为{p.CallAction}的方法,请在{Name}中定义{p.CallAction}方法"); } d.WebData.ResponseData = result; if (d.WebData.ContentType == GoResponseDataType.RazorView) { if (d.WebData.ResponseData == null) { d.WebData.ResponseData = FrameDLRObject.CreateInstance(); } if (d.WebData.MvcModuleData == null) { d.WebData.MvcModuleData = d.WebData.ResponseData; } } }