Tag: object object mapping

是否存在在基于DDD的分层体系结构中的模型和数据访问层之间使用LINQ的建议模式

我一直在阅读Tim McCarthy 关于.NET中DDD的精彩书籍 。 在他的示例应用程序中,他的基础数据访问是使用SqlCE并且他手工编写SQL内联。 我一直在使用一些模式来利用Entity Framework,但我已经陷入了如何将IRepository linq查询映射到底层数据访问层的问题。 我有一个名为的具体存储库实现。 public EFCustomerRepository : IRepository { IEnumerable GetAll( Expression<Func> predicate) { //Code to access the EF Datacontext goes here… } } 在我的EF模型中,我正在使用POCO实体,但即便如此,我的DomainEntity.Customer和我的DataAccessLayer.Customer对象之间也没有本地映射。 所以我不能只将Expression<Func> predicate作为EFContext.Customers.Where(…);的参数EFContext.Customers.Where(…); 是否有一种简单的方法来映射Expression<Func> predicate => Expression<Func> predicate 或者我这样做错了吗? 任何建议/指针赞赏。