DDD数据库。如何处理聚合 [英] DDD Database first . How to handle aggregates

查看:439
本文介绍了DDD数据库。如何处理聚合的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想学习DDD的概念。我做了,我使用的数据库第一种方法的项目。
在基础设施我已经添加了我选择自动生成的entites一个EDMX文件巫婆。现在,在域名我试图创造聚集。

I'm trying to learn the concept of DDD. I have made a project which i use the database first approach. In the infrastructure i have added an edmx file witch i have chosen to auto generate the entites. Now in the "Domain" I'm trying to create aggregates.

但在这里我得到了一些问题。我正尝试创建一个名为用户聚集,但使用者已经在该EF自动生成的entites的存在。我应该聚集用户重命名为别的东西,并从数据库的entites到总数据库映射它获取数据时。

But here i got some problems. I´m trying to create a aggregate named "User" but User already exists in the entites that the ef autogenerated. Should i rename the aggregate "User" to something else and when getting data from the db map it from db entites to the aggregate.

我做错了?或者我不应该自动生成的实体或者说是enties聚集?

I'm doing it wrong ? Or shouldn't i autogenerate the entities or is the enties aggregates ?

PLZ建议和帮助。

< IMG SRC =http://i.stack.imgur.com/DXEz0.pngALT =在这里输入的形象描述>

推荐答案

如果你想成为真正的以国内长途,您应该模拟你的域对象是独立的持久化解决方案。 DDD通过库处理的持久性。请勿使用EF生成为你的领域模型的实体;而不是设计自己的模型,并实现资源库,使持久性使用EF的。

If you want to be true to DDD, you should model your domain objects to be independent of your persistence solution. DDD handles persistence through repositories. Don't use the "entities" generated by EF as your domain model; instead design your own model and implement a repository that makes use of EF for persistence.

这篇关于DDD数据库。如何处理聚合的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆