79142458

Date: 2024-10-30 18:56:54
Score: 2
Natty:
Report link

What is the right way to have a class representing a database view with EF Core?

I think you did just fine to represent the view.

Why doesn't ToView do what it says it should do? ("Configures the view that the entity type maps to when targeting a relational database.")

It actually doing what is supposed to do.

I think what is going to work for you is that you could delete the migrationBuilder.CreateTable(.. to create the view in Migration.Up

Do not specify the view's creation in your migration "Up" if you do not like it do to so...

Reasons:
  • Long answer (-0.5):
  • No code block (0.5):
  • Contains question mark (0.5):
  • Starts with a question (0.5): What is the
  • Low reputation (1):
Posted by: André Giacomini