Skip to content

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

@Snappee

Description

@Snappee

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions