目前我正在學習領域驅動設計。根據我的理解,我創建了一個樣例應用程序,在國家進行一些操作。Get方法如何適合領域驅動設計
我已經裝箱名爲「MyTest.Country」一個類庫,它包含了所有命令 -
--MyTest.Country (ProjectName)
-- Commands (Folder)
--CreateCountry (: ICommand)
--DeleteCountry (: ICommand)
我有一個名爲「MyTest.CountryClient」另一個類庫,使用EF數據庫交互。
--MyTest.CountryClient (Project)
--CountryClass (ClassFile)
--CreateCountry (Method)
--DeleteCountry (Method)
--GetAllCountryList (Method)
另一個名爲「MyTest.CountryServices」的服務的類庫包含處理程序。
--MyTest.CountryServices (Project)
--CountryHandler : IHandleMessages<CreateCountry>
: IHandleMessages<DeleteCountry>
我有一個Web API,它發送命令「MyTest.CountryServices」使用NServiceBus創建或刪除的國家。該消息由CountryHandler處理,然後從「MyTestCountryClient」調用相應的方法。
我知道國家是一個實體,不能被定義爲一個域。但是,我只是試圖實施DDD。
我的問題在這裏 -
我在這裏遵循正確的原則DDD?
如果我想得到所有的國家名單,我應該直接調用MyTest.CountryClient嗎?或者我需要先調用服務,即使對於獲取操作?
看看Udi在這方面的話題:https://skillsmatter.com/skillscasts/1806-talk-from-udi-dahan –
我同意fabriciorissetto,你錯過了存儲庫模式。 – inf3rno