public Schema GetObjectSchema(string objectType, string objectId) { List <Wbo> ret = new List <Wbo>(); WboSchema os = WboSchemaContainer.Instance().GetItem(objectType); if (String.IsNullOrEmpty(os.ContainterType)) { throw new XException("对象配置容器ContainterType没有指定,不能获得" + objectType + "的配置文件"); } Type t1 = Type.GetType(os.ContainterType); Type t = t1.BaseType; MethodInfo m = t.GetMethod("Instance", BindingFlags.Static | BindingFlags.Public); // t.InvokeMember("Instance", BindingFlags.InvokeMethod | BindingFlags.Static, null, null, null, null); object containerIns = m.Invoke(null, null); // SchemaContainer<Schema> objContainer = (containerIns as SchemaContainer<Schema>); MethodInfo GetItem = t.GetMethod("GetItem", BindingFlags.Public | BindingFlags.Instance); Schema schema = (Schema)GetItem.Invoke(containerIns, new object[] { objectId }); return(schema); }
public static void updateWboSchema(string id, WboSchema wboSchema) { if (WboSchemaContainer.Instance().Contains(id)) { WboSchemaContainer.Instance().UpdateItem(id, wboSchema); } }
public List <WboInfo> GetObjectList(string objectType) { List <WboInfo> ret = new List <WboInfo>(); WboSchema os = WboSchemaContainer.Instance().GetItem(objectType); if (String.IsNullOrEmpty(os.ContainterType)) { WboInfo objSum = new WboInfo(); objSum.name = ""; objSum.title = os.Title; objSum.comId = objectType; ret.Add(objSum); return(ret); } Type t1 = Type.GetType(os.ContainterType); if (t1 == null) { throw new XException("不能重程序中加载类型,请检查配置:" + os.ContainterType); } Type t = t1.BaseType; MethodInfo m = t.GetMethod("Instance", BindingFlags.Static | BindingFlags.Public); // t.InvokeMember("Instance", BindingFlags.InvokeMethod | BindingFlags.Static, null, null, null, null); object containerIns = m.Invoke(null, null); // SchemaContainer<Schema> objContainer = (containerIns as SchemaContainer<Schema>); MethodInfo GetSchemaIds = t.GetMethod("GetSchemaIds", BindingFlags.Public | BindingFlags.Instance); MethodInfo GetItem = t.GetMethod("GetItem", BindingFlags.Public | BindingFlags.Instance); object oObjIds = GetSchemaIds.Invoke(containerIns, null); string[] objIds = (oObjIds as string[]); //objContainer.GetSchemaIds(); for (int i = 0; i < objIds.Length; i++) { Schema s = (Schema)GetItem.Invoke(containerIns, new object[] { objIds[i] }); WboInfo objSum = new WboInfo(); objSum.name = s.Id; objSum.title = s.Title; if (string.IsNullOrEmpty(objSum.title)) { objSum.title = s.Id; } objSum.description = s.Description; objSum.comId = objectType; ret.Add(objSum); } return(ret); }
private static Validator CreateValidator(string name) { WboSchema objSchema = ValidatorSchemaContainer.Instance().GetItem(name); object obj = ObjectFactory.CreateObject(objSchema); if (!(obj is Validator)) { throw new XException("加载的对象没有继承校验接口,不是校验器类型"); } return(obj as Validator); }
public static List <TreeNode> getWboPropertyNodes(string comId) { List <TreeNode> ret = new List <TreeNode>(); WboSchema wboSchema = WboSchemaContainer.Instance().GetItem(comId); foreach (Schema propSchema in wboSchema.Properties) { TreeNode node = new TreeNode(); node.text = string.IsNullOrEmpty(propSchema.Title) ? propSchema.Id : propSchema.Title; node.id = comId + Umc.MemberSpliter + propSchema.Id; ret.Add(node); } return(ret); }
public static List <TreeNode> getWboMethodNodes(string comId) { List <TreeNode> ret = new List <TreeNode>(); WboSchema wboSchema = WboSchemaContainer.Instance().GetItem(comId); foreach (WboMethodSchema wms in wboSchema.Methods) { TreeNode node = new TreeNode(); node.text = string.IsNullOrEmpty(wms.Title) ? wms.Id : wms.Title; node.id = comId + Umc.MemberSpliter + wms.Id; ret.Add(node); } return(ret); }
public static Dictionary <string, string> getWboIds() { Dictionary <string, string> ret = new Dictionary <string, string>(); string[] xmls = WboSchemaContainer.Instance().GetIDsByFolder(""); foreach (string id in xmls) { WboSchema ws = getWboSchema(id); if (ws.IsPublish) { ret.Add(id, ws.Title); } } return(ret); }
public static List <TextValue> getWboTextValues() { List <TextValue> ret = new List <TextValue>(); string[] xmls = WboSchemaContainer.Instance().GetIDsByFolder(""); foreach (string id in xmls) { WboSchema ws = getWboSchema(id); if (ws.IsPublish) { ret.Add(new TextValue() { text = ws.Title, value = id }); } } return(ret); }
public static void saveWboSchema(WboSchema wboSchema) { if (wboSchema == null) { return; } WboProxy wp = WboProxyFactory.getWboProxy(wboSchema); if (wp.getWboType().IsSubclassOf(typeof(ISessionWbo))) { wboSchema.LifeCycle = LifeCycle.Session; } if (WboSchemaContainer.Instance().Contains(wboSchema.Id)) { WboSchemaContainer.Instance().UpdateItem(wboSchema.Id, wboSchema); } }
public static List <Wbo> GetVboTypes() { List <Wbo> ret = new List <Wbo>(); string[] ids = WboSchemaContainer.Instance().GetSchemaIds(); for (int i = 0; i < ids.Length; i++) { string id = ids[i]; WboSchema os = WboSchemaContainer.Instance().GetItem(id); if (os.IsPublish && os.IsVisual) { Wbo objSum = new Wbo(); objSum.name = os.Id; objSum.title = os.Title; objSum.description = os.Description; ret.Add(objSum); } } return(ret); }
public static List <TreeNode> getWboNodes() { List <TreeNode> treeNodes = new List <TreeNode>(); string[] xmls = WboSchemaContainer.Instance().GetIDsByFolder(""); int nid = 0; foreach (string name in xmls) { WboSchema ws = getWboSchema(name); TreeNode tn = new TreeNode(); tn.id = nid + ""; nid++; tn.label = ws.Title; tn.name = name; tn.text = ws.Title; tn.url = ""; treeNodes.Add(tn); } return(treeNodes); }
public static void saveWboSchema(string josn) { WboSchema wboSchema = (WboSchema)JsonConvert.DeserializeObject(josn, typeof(WboSchema)); WboExplore.saveWboSchema(wboSchema); }