4

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?

3
  • Maybe you can using code-first. Just create tu DbSets with different names. Commented Dec 17, 2018 at 15:54
  • 1
    Possible duplicate of Multiple Tables With Same Structure Entity Framework Commented Dec 17, 2018 at 16:09
  • @OscarVicentePerez, i tried to add another create DbSet with different name, it does not work. Commented Dec 17, 2018 at 16:18

2 Answers 2

1

Multiple Tables With Same Structure Entity Framework

I guess the above might help you.

Sign up to request clarification or add additional context in comments.

Comments

-2

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.