0

I am thinking about using Entity Framework Core in a new project. The project has a many to many relationship. Entity framework Core does not allow shadow state entities as described here: https://github.com/aspnet/EntityFrameworkCore/issues/1368

There are two options for the design:

1) Create a CLR type for the junction table in the database.

2) Create a CLR type for the junction table in the database. Then hide it using a fascade as described here: https://blog.oneunicorn.com/2017/09/25/many-to-many-relationships-in-ef-core-2-0-part-4-a-more-general-abstraction/

The junction table in the database contains foreign key attributes only. I am interested to hear how others have approached DDD when using EF Core as the database. Am I overthinking this? Is the answer just to use option 1 and forget about it?

  • 3) stick with SqlClient and other better ways to query databases – Ewan Dec 18 '18 at 18:16
  • An ORM is a tool. I cannot recommend directly using the data model generated by EF as your domain model. With that in mind, we can see that your question has very little to do with DDD. Use whatever tools you would like behind your repositories. – king-side-slide Dec 27 '18 at 17:35

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.