資訊系統開發平台OpenExpressApp - 應用程式模型ApplicationModel

來源:互聯網
上載者:User
文章目錄
  • 應用程式模型貫穿於整個架構層
  • 模型關注what
  • ApplicationModel
  • Command模型

  為OpenExpressApp的系統架構圖,其中在應用程式模型是作為一種中繼資料貫穿於整個架構,應用程式模型運行在OpenExpressApp架構之上。應用程式模型是OEA的核心,理解好應用程式模型才能更好的使用OEA。

應用程式模型貫穿於整個架構層模型關注what

  OEA希望從重複的技術工作中脫離出來,在經過大量實踐基礎之上對一些常用功能進行抽象,整理和總結出一些通用模型,在基於模型的描述下,我們更加關注的是what,而不是how。OpenExpressApp平台建模工具計劃支援企業架構建模(EA)、介面建模(UI)、命令擴充(Command)、領域建模(Domain)、規則建模(Rule)、報表模型(Report)和工作流程模型(Workflow)。目前OEA的應用程式模型主要有UI模型和Command模型。

  模型可以通過多種方式定義,如代碼、屬性標識和建模等,目前OEA支援類屬性標識產生應用程式模型,這個一般用在簡單應用軟體中,計劃加入建模工具,那時就不需要在類庫中標識UI模型了。

ApplicationModel

  既然我們使用模型來開發,那麼必然會有一個存放模型的地方,在OEA中UI模型和Command模型都統一放置在ApplicationModel靜態類中。

Code
      /// 應用程式模型
      public static class ApplicationModel
    {
        /// 應用程式中所有的命令對象
        public static readonly CommandCollection Commands = new CommandCollection();
        /// 預設的所有業務物件模型集合    public static readonly ObservableCollection<BusinessObjectInfo> DefaultBusinessObjectInfos = new ObservableCollection<BusinessObjectInfo>();
        /// 尋找指定類型對應的業務物件模型中繼資料, 如果沒有尋找到,則產生並儲存一個新的。
        public static BusinessObjectInfo AddBusinessObject(Type boType)
        {
            BusinessObjectInfo info = null;
            BusinessObjectInfoDict.TryGetValue(boType, out info);
            if (info == null)
            {
                info = new BusinessObjectInfo(boType);
                BusinessObjectInfoDict.Add(boType, info);
                if (info.IsDefaultObject)
                {
                    DefaultBusinessObjectInfos.Add(info);
                }
            }
            return info;
        }
       public static BusinessObjectInfo GetBusinessObjectInfo(Type boType)
        {
            BusinessObjectInfo info = null;
            BusinessObjectInfoDict.TryGetValue(boType, out info);
            if (null == info)
            {
                info = AddBusinessObject(boType);
            }
            return info;
        }
    }

應用程式模型中有三個重要的類:

  1. BusinessObjectInfo:業務對象資訊,通過ApplicationModel.AddBusinessObject調用
  2. BusinessObjectPropertyInfo:屬性資訊,在BusinessObjectInfo建構函式中產生
  3. BusinessObjectsPropertyInfo:子物件屬性資訊,在BusinessObjectInfo建構函式中產生
Code
  public BusinessObjectInfo(Type boType)
        {
      ...
            foreach (PropertyInfo item in boType.GetProperties())
            {
                if (item.HasMarked<EntityPropertyAttribute>())
                {
                    BOPropertyInfos.Add(new BusinessObjectPropertyInfo(item, this));
                }
                if (item.HasMarked<AssociationAttribute>())
                {
                    AssociationAttribute attr = item.GetSingleAttribute<AssociationAttribute>();
                    BOsPropertyInfos.Add(new BusinessObjectsPropertyInfo(item, attr, this));
                    if (attr.ShowInTree)
                    {
                        TreeChildPropertyInfo = item;
                    }
                }
            }
        }UI模型

資訊系統開發平台OpenExpressApp - 內建支援的屬性編輯方式

資訊系統開發平台OpenExpressApp - 內建支援的列表編輯方式

資訊系統開發平台OpenExpressApp - 理解核心元素ObjectView

資訊系統開發平台OpenExpressApp - AutoUI自動產生介面

Command模型

資訊系統開發平台OpenExpressApp - Command擴充機制

更多內容: 開源資訊系統開發平台之OpenExpressApp架構.pdf

 

歡迎轉載,轉載請註明:轉載自周金根 [ http://zhoujg.cnblogs.com/ ]

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.