[轉]在NopCommerce中新增一個Domain Model的步驟

來源:互聯網
上載者:User

標籤:http   comm   struct   archive   upd   映射   nop   map   core   

本文轉自:http://www.cnblogs.com/aneasystone/archive/2012/08/27/2659183.html

在NopCommerce中新增一個Domain Model,需要以下幾個步驟:

1. 建立一個Entity Class (Nop/Core/Domain/Entity.cs)

2. 建立一個Mapping Class (Nop/Data/Mapping/EntityMap.cs)

3. 建立一個View Model (Nop/Admin/Models/EntityModel.cs 或 Nop/Web/Models/EntityModel.cs)

4. 建立Model Validator (Nop/Admin/Validators/EntityValidator.cs 或 Nop/Web/Validators/EntityValidator.cs)

5. 為AutoMapper建立映射配置,用來完成Model和Entity之間的轉換 (Nop/Admin/Infrastructure/AutoMapperStartupTask.cs 或 Nop/Web/Infrastructure/AutoMapperStartupTask.cs)

6. 編寫ToModel和ToEntity (Nop/Admin/MappingExtensions.cs 或 Nop/Web/MappingExtensions.cs)

7. 建立Service和Service Interface (Nop/Services/EntityService.cs 和 Nop/Services/IEntityService.cs)

8. 最後建立的Model建立Controller和View

PS: NopCommerce不支援database migration,需要手動更新資料庫。

參考資料:http://www.nopcommerce.com/docs/73/updating-an-existing-entity-how-to-add-a-new-property.aspx

[轉]在NopCommerce中新增一個Domain Model的步驟

聯繫我們

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