My team is starting a new project using Entity Framework Code First. We have a new, empty database for the project; the schema will be managed through Code First migrations.
However, there is one piece of data that we will need to access that lives in an external database (managed by a different project). We were given access to this data through a view in our own database that maps to a table in the external database.
Because of this setup, we have two competing requirements:
- When creating migrations, Entity Framework should not try to create or edit the view.
- At runtime, we should still be able to query/insert/update/delete data through the view using Entity Framework as if it is a regular table.
We've looked at both the [NotMapped] attribute and the .Ignore() method, but both seems to only satisfy one of the two requirements above.
Is this configuration possible using Entity Framework Code First, or will we need to switch to Database First?
We're using Entity Framework Core version 2.1.1.