EF core 2 not supporting many-to-many relations without fluent or join table right now. I read a article in APB documents that related to use Data layer for mapping and data filters. So if I had a module class library please give me the tips whats steps to create CustomModelBuilder for fluent API in MyModule? I'm student special thanks for any help with inline simple code. Regards
6 Answer(s)
-
0
[quote="alper"][list] Thank you for helpful links Is there any suggestion about fluent models builder? I think the Fluent API provider and interface's can be a good feature for ABP Framework. I don't know! Maybe I'm wrong
-
0
hi
maybe you should check this tutorial: <a class="postlink" href="https://www.tutorialspoint.com/entity_framework/entity_framework_fluent_api.htm">https://www.tutorialspoint.com/entity_f ... nt_api.htm</a>
and official Microsoft doc: <a class="postlink" href="https://msdn.microsoft.com/en-us/library/jj591617(v=vs.113">https://msdn.microsoft.com/en-us/librar ... 7(v=vs.113</a>).aspx
-
0
<cite>alper: </cite> hi
maybe you should check this tutorial: <a class="postlink" href="https://www.tutorialspoint.com/entity_framework/entity_framework_fluent_api.htm">https://www.tutorialspoint.com/entity_f ... nt_api.htm</a>
and official Microsoft doc: <a class="postlink" href="https://msdn.microsoft.com/en-us/library/jj591617(v=vs.113">https://msdn.microsoft.com/en-us/librar ... 7(v=vs.113</a>).aspx
MSDN link is broken and first link tutorial is not covered by EF Core 2 because EF core 2 not generate join table. [https://github.com/aspnet/EntityFrameworkCore/issues/1368]) We need create that manually. Is can be hard for a project like eShop. Using fluent api in DbContext class's makes a ugly code if we have +10 tables. So what the best way?
-
0
[https://www.learnentityframeworkcore.com/configuration/fluent-api])
In version 2.0 onwards, this is accomplished by creating classes that implement IEntityTypeConfiguration<TEntity> and adding the fluent configuration code to a Configure method
-
0
Fluent API is the proper way.
Using fluent api in DbContext class's makes a ugly code if we have +10 tables.
If that's what you're concerned about, you can extract the code into a static helper similar to CustomDtoMapper.