jasontaylordev / NorthwindTraders

Northwind Traders is a sample application built using ASP.NET Core and Entity Framework Core.
MIT License
5k stars 1.59k forks source link

In CleanArchitechture Project Which is the best place or layer to use POCO Entity Generator from Database? #240

Closed anomepani closed 1 year ago

anomepani commented 4 years ago

@jasontaylordev In CleanArchitechture Project Which is the best place or layer to use POCO Entity Generator from Database.

As POCO Generator Generates lots of domain model without writing any code based on the database schema and also generate methods based on Stored Procedure and Map their model based on return type of result, which is very useful feature of POCO Entity Generator.

Thanks In Advance

lukehammer commented 4 years ago

My understanding is that the Poco Entity Generator and Domain Driven designs are opposed.

In domain-driven design, your database project should produce your domain-Entities that are designed in your domain project.

This is confusing when using entity framework because database-first entities are called domain entities by entity framework But they are not the same as Domain-Entities in Domain-driven design.

If there is a POCO generator that should only exist within your data-access layer which should be infrastructure. and it should not be accessible by anything else.

In all cases, I've seen so far. Most designs are taking a code-first design to create a link to the database. What I understand you are attempting to do is a database first approach.

I think that is backward. Your domain should not care how the data is stored. While it is possible IIMHO would not recommend this practice. Learning how to update your database via code, I think is the better practice.

jasontaylordev commented 1 year ago

Thank you for your interest in this project. This repository has been archived and is no longer actively maintained or supported. We appreciate your understanding. Feel free to explore the codebase and adapt it to your own needs if it serves as a useful reference. If you have any further questions or concerns, please refer to the README for more information.