Can I create multiple tables using the same models with EF Core? My requirement to create multiple tables(with diff names) with the same models and they do not need to share any information. Is that possible with Entity Framework Core in asp.net core?
-
Maybe you can using code-first. Just create tu DbSets with different names.– Oscar Vicente PerezDec 17, 2018 at 15:54
-
1Possible duplicate of Multiple Tables With Same Structure Entity Framework– user3247458Dec 17, 2018 at 16:09
-
@OscarVicentePerez, i tried to add another create DbSet with different name, it does not work.– Pragna PasunuriDec 17, 2018 at 16:18
2 Answers
Multiple Tables With Same Structure Entity Framework
I guess the above might help you.
No, you can't, and the desire to do so usually is a database design smell. Consider redesigning your table layout. Perhaps adding a column to differentiate between records can help.
See also GitHub aspnet/EntityFrameworkCore #7299: Using the same class (model) to create two tables.