小编Ped*_*ruz的帖子

在List或DropdownList,DDD中加载Value对象

我需要澄清一些事情.

有人积极,2个VOs(国家,州政府).

我想在我的表示层中加载所有国家/地区(我正在使用mvc)

Evan说你只使用存储库(IPersonRepository)来处理root实体(它应该总是只返回对Aggregate Root的引用)

   public interface IPersonRepository()
   {
     void savePerson(Person p);
     void removePerson(Person p);
     Ilist<Person> getPerson();
   }
Run Code Online (Sandbox Code Playgroud)

我通常做的是解决这个问题:

在IPersonRepository中添加此方法

IList<Country> LookupCountrysOfPerson();
Run Code Online (Sandbox Code Playgroud)

在Infra层实现Domain接口,如下所示:

public IList<Person> LookupCountrysOfPerson()
{
    return Session.CreateQuery("from Countrys").List<Person>());
}
Run Code Online (Sandbox Code Playgroud)

我的伙伴说错了.

有时您必须牺牲您的域模型才能完成某项任务

做这个的最好方式是什么?

请带代码!:)

domain-driven-design ddd-repositories

7
推荐指数
2
解决办法
3257
查看次数

目录中的文件夹数

我如何知道目录中的文件夹数量?

我尝试使用System.IO.Directory但没有运气.

c# asp.net

7
推荐指数
2
解决办法
2万
查看次数