M
M
Max Serge2022-04-19 17:36:30
SQL
Max Serge, 2022-04-19 17:36:30

Ef Core 5 "many to many" in OnModelCreating with extra fields?

Everywhere they write that conceptually there are two ways to create a many-to-many relationship on ef core 5 and higher.
1. The simplest one, the prescription in OnModelCreating, in this case it is impossible to influence this entity in any way in terms of adding new fields (or is it possible?)
2. More "complex", in addition to the prescription in OnModelCreating, the entity that is automatically generated by ef core is recreated and if necessary completed with the required fields.
There is an already established system in which it was necessary to create a many-to-many relationship, but with additional fields.
Actually, the question is how to register such an entity in the second way, but so that you don’t have to work through this table, filling requests with endless include, on Net, the first copy-paste links say that this cannot be done, so I’m here.
As an option, register two methods simultaneously in this system, so that it is possible to communicate without intermediaries, but have variability in the form of adding additional fields. But I have no idea how to do it. I'm waiting for any help, while I'm looking for and trying to do something.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question