微型項目實踐(1):用XML描述實體

來源:互聯網
上載者:User

系統設計的第一步當然是分析需求,目前能夠想到的就是對日誌的管理,恩……再加上一個分類好了 ,大體就是這樣子:

我們使用一個XML來描述這兩個實體:

  1: <?xml version="1.0" encoding="utf-8" ?>  2: <Entities xmlns="http://it.ouc.edu.cn/EntityDescription/V2">  3:  <Entity title="日誌" name="Blog" module="Blogs">  4:   <Item title="標題" name="Title" type="text" require="true"/>  5:   <Item title="內容" name="Content" type="longtext" require="false"/>  6:   <Item title="所屬分類" name="BlogClass" type="entity" entityName="BlogClass" require="false"/>  7:   <Item title="建立時間" name="CreateDateTime" type="datetime" require="true"/>  8:   <Item title="更新時間" name="UpdateDateTime" type="datetime" require="true"/>  9:  </Entity> 10:  <Entity title="日誌分類" name="BlogClass" module="Blogs"> 11:   <Item title="名稱" name="Name" type="text" require="true"/> 12:   <Item title="描述" name="Description" type="text" require="false"/> 13:  </Entity> 14: </Entities>

這個XML很容易看懂,它的Schema定義在“http://it.ouc.edu.cn/EntityDescription/V2”中,根節 點表示這個XML定義的是實體的集合(Entities)。每一個實體包含很多資料欄位,欄位有標題、名稱、 類型等屬性,需要注意的是,這裡的資料欄位不表示資料庫設計,也不表示類的設計,只是實體的業務邏 輯定義。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.