2013-01-04 42 views
0

我通過Repository模式在The Repository PatternRepository模式和數據集

讀取下向該溶液部分中,其中提到

數據源層和業務 層應用程序之間的信息庫介導。它向數據源查詢數據, 將來自數據源的數據映射到業務實體,並將業務實體中的更改持續到數據源。存儲庫 將業務邏輯從與底層數據源或Web服務的交互中分離出來。

那麼,是否容易將數據集稱爲存儲庫模式的示例。我還發現目標部分

您想最大限度地利用自動化可以測試的代碼量並隔離數據層以支持單元測試。

哪個,可以用任何一個例子來解釋?

感謝數不勝數

回答

1

回答:沒有,他們的目的不同。

數據集represents an in-memory cache of data並且不提供修改數據的方法。

相比之下,提供的方法與數據進行操作:objects can be added to and removed from the Repository, as they can from a simple collection of objects, and the mapping code encapsulated by the Repository will carry out the appropriate operations behind the scenes

PS:你可能會發現我的答案是不語言無關,在這種情況下,請連同提供更多詳細信息,請問題

+0

感謝您的一個很好的解釋。我能夠理解這個概念:) –