-
-
Notifications
You must be signed in to change notification settings - Fork 158
Cannot Change HasMany Relationship #993
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
Comments
Can you post the produced SQL? To make it visible in logs, add this to {
"Logging": {
"LogLevel": {
"Microsoft.EntityFrameworkCore.Database.Command": "Information"
}
}
} |
@bart-degreed, here is the relevant part of the log, including the initial part of the exception message. The rest of that is the same as in my original description.
Looking at this, The public abstract class EntityBase<TId> : Identifiable<TId>
{
[UsedImplicitly]
public DateTimeOffset? DateCreated { get; set; }
[UsedImplicitly]
public DateTimeOffset? DateModified { get; set; }
/// <summary>
/// Gets or sets the concurrency token.
/// </summary>
[UsedImplicitly]
[Timestamp]
public byte[] RowVersion { get; set; }
} The table definition (from which I removed columns that are not relevant for this issue) looks like this:
The |
Yes, this fails because of RowVersion. This currently does not work. We have an open issue on our roadmap to enable support for clients to send the version and make optimistic concurrency work. Until then, I recommend to remove it, because it doesn't help much right now. For efficiency, Delete Resource and Post ToMany Relationship endpoints do not fetch everything, so the row version is never retrieved. If you insist on using RowVersion right now, at the very least you'd need to override |
OK, I should be able to remove the |
Concerning RowVersion, see our proposal at #1004. Feel free to express your opinion about the proposal by adding a comment to it. |
DESCRIPTION
I am trying to update a HasMany relationship between one
WorkingTree
and manyDocument
resources as described in the documentation under Changing HasMany relationships. I am currently testing this with Postman, where{{url}}
is the server URL and{{working_tree_id}}
and{{document_id}}
areGuid
s of existingWorkingTree
andDocument
entities, respectively:However, that leads to the following exception:
What works is the following:
STEPS TO REPRODUCE
Here's the
WorkingTree
definition, whereEntityBase<Guid>
is anIdentifiable<Guid>
with some default properties added to every resource.EXPECTED BEHAVIOR
The
HasMany
relationship can be changed as documented.ACTUAL BEHAVIOR
Changing the
HasMany
relationship as documented throws an exception.VERSIONS USED
4.1.1
5.0
5.0
The text was updated successfully, but these errors were encountered: