EntityFramework.Docs icon indicating copy to clipboard operation
EntityFramework.Docs copied to clipboard

Example assumes I don't want to overwrite the primary key - what if the operation is perfectly fine?

Open Snappee opened this issue 3 years ago • 2 comments
trafficstars

The example shows only ONE valid way to deal with the concurrency issue - with the assumption that the exception caught the issue and the original values should be re-read from the database as such and maybe the user needs to be informed.

What it doesn't talk about, nor show is what if the issue is NOT an issue - that the desired functionality was to CHANGE a key field? I can manually use the SQL Manager to change a key field - as there are no conflicts with other tables (dependencies) - but EF Core will throw a concurrency exception as if there is.

What I don't know is WHAT needs to be done to complete the primary key edit? Is this an issue due to having the same records displayed in a DataGrid view? (And now I'm trying to pragmatically edit a primary key field and save the changes?).

You need to enhance the example and not assume that the concurrency always catches a conflict - as there may not really be one.

Thanks


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Snappee avatar Jul 31 '22 17:07 Snappee

@Snappee EF should throw a different exception if you attempt to change a key property value. Please attach a small, runnable project or post a small, runnable code listing that reproduces what you are seeing so that we can investigate.

ajcvickers avatar Aug 01 '22 12:08 ajcvickers

Hey Arthur . . . will put together a little Winforms C# example later this week - though it will have a small database (SQL Server backup) with it (as my guess is that it will need the DB and the DataGridView that binds to it).

All the Best,

Dale O. Hays SINNOVATE East Bay Labs VHP - Vintage Horsepower cell: 614-404-8641 eMails: @., @., @.***,

Quote of the Month: "Positive Dissatisfaction is a key driver of many new products . . . it can ALWAYS be better!**" - Dale Hays

On Mon, Aug 1, 2022 at 8:15 AM Arthur Vickers @.***> wrote:

@Snappee https://github.com/Snappee EF should throw a different exception if you attempt to change a key property value. Please attach a small, runnable project or post a small, runnable code listing that reproduces what you are seeing so that we can investigate.

— Reply to this email directly, view it on GitHub https://github.com/dotnet/EntityFramework.Docs/issues/3963#issuecomment-1201124352, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACHPF36JR74UAFTPBLFCTCDVW65U3ANCNFSM55FGTFIQ . You are receiving this because you were mentioned.Message ID: @.***>

Snappee avatar Aug 01 '22 12:08 Snappee

EF Team Triage: Closing this issue as the requested additional details have not been provided and we have been unable to reproduce it.

BTW this is a canned response and may have info or details that do not directly apply to this particular issue. While we'd like to spend the time to uniquely address every incoming issue, we get a lot traffic on the EF projects and that is not practical. To ensure we maximize the time we have to work on fixing bugs, implementing new features, etc. we use canned responses for common triage decisions.

ajcvickers avatar Aug 15 '22 16:08 ajcvickers