public void saveMethod(FBCMPMethod model) { try { base.Db.BeginTransaction(); base.Db.Save <FBCMPMethod>(model); base.Db.Execute(new Sql(@" delete from FBCMPPara where MethodID =@0 ", model.ID)); foreach (FBCMPPara para in model.ParaList) { if (string.IsNullOrEmpty(para.ID)) { para.ID = Guid.NewGuid().ToString(); } para.CMPID = model.CMPID; para.MethodID = model.ID; base.Db.Save <FBCMPPara>(para); } //FBMeta.UpdateMeataInfo(model.Name, model.Code, model.ID, base.Db);//更新元数据编号 this.Db.CompleteTransaction(); } catch (Exception ex) { base.Db.AbortTransaction(); throw ex; } }
public JsonResult getMethodList() { try { HttpPostedFileBase file = Request.Files["file"]; // var path = AppDomain.CurrentDomain.BaseDirectory + "DllTmp/"; //path += file.FileName; //file.SaveAs(path); List <FBComponent> list = new List <FBComponent>(); Assembly ass = Assembly.Load(StreamToBytes(file.InputStream)); foreach (var type in ass.GetTypes()) { FBComponent model = new FBComponent(); model.AssemblyName = type.Namespace; model.ClassName = type.Name; MethodInfo[] members = type.GetMethods(BindingFlags.Public | BindingFlags.Instance);// model.MethodList = new List <FBCMPMethod>(); foreach (MethodInfo member in members) { if (member.Name != "ToString" && member.Name != "Equals" && member.Name != "GetHashCode" && member.Name != "GetType") { FBCMPMethod mMethod = new FBCMPMethod(); mMethod.MethodName = member.Name; mMethod.ReturnType = getByType(member.ReturnType); mMethod.ParaList = new List <FBCMPPara>(); foreach (var para in member.GetParameters()) { FBCMPPara mPara = new FBCMPPara(); mPara.ParamName = para.Name; mPara.ParamType = getByType(para.ParameterType); mMethod.ParaList.Add(mPara); } model.MethodList.Add(mMethod); } //Console.WriteLine(type.Name + "." + member.Name); } list.Add(model); } return(Json(new { res = true, data = list })); } catch (Exception ex) { return(Json(new { res = false, mes = "操作失败" + ex.Message })); //throw ex; } }