efcore icon indicating copy to clipboard operation
efcore copied to clipboard

Allow specifying ON UPDATE behavior

Open bricelam opened this issue 5 years ago • 5 comments
trafficstars

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.

bricelam avatar Jul 08 '20 15:07 bricelam

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 avatar Sep 02 '21 14:09 TonyValenti

@TonyValenti to vote, please do :+1: on the top-most post.

roji avatar Sep 02 '21 15:09 roji

Thanks! Voted!

TonyValenti avatar Sep 02 '21 15:09 TonyValenti

How has this not received more votes? Do people not know about this forum?

SoftCircuits avatar Dec 04 '21 19:12 SoftCircuits

Bump 👀 2024

DanteMarshal avatar Feb 13 '24 17:02 DanteMarshal

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!

NastouhGit avatar Jun 05 '24 08:06 NastouhGit

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.

darcome avatar Jul 28 '24 17:07 darcome