Exemplo n.º 1
0
 /// <summary>
 /// 获取业务对象
 /// </summary>
 /// <param name="ObjectFolder"></param>
 /// <returns></returns>
 public List<AppModel> ListModel(List<string> ObjectFolder)
 {
     List<AppModel> List = new List<AppModel>();
     foreach (var item in ObjectFolder)
     {
         string Path = System.Web.Hosting.HostingEnvironment.MapPath("~/BusinessObjects/" + item + "/BOList.xml");
         //D:\smt2010\SMT.Workflow\SourceCode\SMT.Workflow\SMT.Workflow.Services\SMT.Workflow.Services.Platform\SMT.Workflow.Platform.Services\BusinessObjects\EDM\BOList.xml
         //SMT.Workflow.Common.DataAccess.LogHelper.WriteLog("获取业务对象路径:" + Path);
         if (File.Exists(Path))
         {
             XDocument xdoc = XDocument.Load(Path);
             var xmlTree = from c in xdoc.Descendants("ObjectList").Descendants<XElement>("Object")
                           select c;
             if (xmlTree.Count() > 0)
             {
                 foreach (var v in xmlTree)
                 {
                     AppModel model = new AppModel();
                     model.Name = v.Attribute("Name").Value;
                     model.Description = v.Attribute("Description").Value;
                     model.ObjectFolder = item;
                     List.Add(model);
                 }
             }
             xdoc = null;
         }
     }
     return List;
 }
Exemplo n.º 2
0
        public List<AppModel> AppModel(string ObjectFolder)
        {
            List<AppModel> List = new List<AppModel>();
            try
            {
                string Path = System.Web.Hosting.HostingEnvironment.MapPath("~/BusinessObjects/" + ObjectFolder + "/BOList.xml");
                XDocument xdoc = XDocument.Load(Path);
                var xmlTree = from c in xdoc.Descendants("ObjectList").Descendants<XElement>("Object")
                              select c;
                if (xmlTree.Count() > 0)
                {
                    foreach (var v in xmlTree)
                    {
                        AppModel model = new AppModel();
                        model.Name = v.Attribute("Name").Value;
                        model.Description = v.Attribute("Description").Value;
                        model.ObjectFolder = ObjectFolder;
                        List.Add(model);
                    }
                }
            }
            catch
            {

            }
            return List;
        }