efcore
efcore copied to clipboard
Allow specifying ON UPDATE behavior
modelBuilder.Entity<Post>()
.HasOne(p => p.Blog).WithMany(b => b.Posts)
.OnUpdate(UpdateBehavior.Cascade);
Without this, any behavior specified in Migrations is lost when a table gets rebuilt.
This is loosely related to #4073, but can be done independently.
Hi @ajcvickers - I wanted to add my vote to this. We could really use this feature. For us, we'll be modifying the key values by hand but it would be really nice if EFCore could create the key relationships with cascade update so that we wouldn't have to modify all our keys in SQL Server.
@TonyValenti to vote, please do :+1: on the top-most post.
Thanks! Voted!
How has this not received more votes? Do people not know about this forum?
Bump 👀 2024
Please add this, I don't like change all times for all table changed migration file! Maybe I want to delete file and regenerate again many times!
Any update on this? As a MariaDb and MySql user, this feature would be very useful, especially if the primary key is sort of self-speaking and may be changed in the future.
I know that this may be a code smell, but if you inherit the db and is not worth changing the ddl, this feature is very useful.