-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support updatable views #20013
Comments
@AndriySvyryd @ajcvickers @JeremyLikness I have the following code in my OnModelCreating method.
When I execute the following code from my Main method, I am noticing that the changes are getting successfully reflected on the database. I was expecting that the update will not go through because I thought updating of views from EFCORE is not supported. May be I have not understood the scope of this github issue. Please could you help me understand?
I am using an Oracle DB and the view that I have created on the DB has a primary key constraint on the Id column of the view. Other Info: |
@pfdsilva In 3.1.5 SaveChanges doesn't differentiate between views and tables, so it will try to update whatever is configured. In 5.0 you'll be able to map an entity type to both a view and a table and SaveChanges will only use the table mapping |
@AndriySvyryd When using scaffolding, there is no way to tell it to use |
@johnwc You may be able to set it ToTable and specify a Key in a partial class that implements the OnModelCreatingPartial method |
Split off #17270
Would be configured using something like
.ToView(updatable: true)
and would be used instead of the configured table for CUD operations.The text was updated successfully, but these errors were encountered: