开发者

Passing entities to other layers? (ddd noob)

I am exploring sharp architecture, and have seen that it is actually passing the entities around to other layer (as far as presentation layers). S开发者_高级运维houldn't it be exposing interfaces of the entities to make it more loosely coupled? Or am I missing something?


I believe that you can pratice DDD in many ways and most important is to actually look at your project needs and situation. If you will pratice DDD on a asp.net MVP or MVC web application and the the application will probably not talking to other external systems. Then it can be overkill to use a service layer and DTO objects just for NOT letting the presentation layer know anything about the domain. Most important is that you hide/remove knowledge of creation of entities, domain logic and possibilites to put entities in a invalid state. All this can be achieved with a good Domain entity api. Then I feel it can be a good practice to send entities down to presention layer. You can also use repositories for loading entities in your Controller/Presenter classes in presentation layer. If you look at a lot of DDD examples you'll find that people tend to to what suites them best. I have never seen any example and practices where you expose your entities with interfaces. You can achieve a lot with just internal, protected and readonly attributes. This will hide api features for presentation layer.

/Best regards BacceSR

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜