{"action":"opened","issue":{"url":"https://api.github.com/repos/aspnet/EntityFrameworkCore/issues/12865","repository_url":"https://api.github.com/repos/aspnet/EntityFrameworkCore","labels_url":"https://api.github.com/repos/aspnet/EntityFrameworkCore/issues/12865/labels{/name}","comments_url":"https://api.github.com/repos/aspnet/EntityFrameworkCore/issues/12865/comments","events_url":"https://api.github.com/repos/aspnet/EntityFrameworkCore/issues/12865/events","html_url":"https://github.com/aspnet/EntityFrameworkCore/issues/12865","id":346978459,"node_id":"MDU6SXNzdWUzNDY5Nzg0NTk=","number":12865,"title":"Changes on Owned Entites Properties causes a concurrency conflict on same dbContext","user":{"login":"JakobFerdinand","id":16666458,"node_id":"MDQ6VXNlcjE2NjY2NDU4","avatar_url":"https://avatars3.githubusercontent.com/u/16666458?v=4","gravatar_id":"","url":"https://api.github.com/users/JakobFerdinand","html_url":"https://github.com/JakobFerdinand","followers_url":"https://api.github.com/users/JakobFerdinand/followers","following_url":"https://api.github.com/users/JakobFerdinand/following{/other_user}","gists_url":"https://api.github.com/users/JakobFerdinand/gists{/gist_id}","starred_url":"https://api.github.com/users/JakobFerdinand/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JakobFerdinand/subscriptions","organizations_url":"https://api.github.com/users/JakobFerdinand/orgs","repos_url":"https://api.github.com/users/JakobFerdinand/repos","events_url":"https://api.github.com/users/JakobFerdinand/events{/privacy}","received_events_url":"https://api.github.com/users/JakobFerdinand/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-08-02T11:52:57Z","updated_at":"2018-08-02T11:52:57Z","closed_at":null,"author_association":"NONE","body":"When changing an `Owned Entities Property` than save twice, the second `SaveChanges` call throws an `DbUpdateConcurrencyException` because the local entities rowversion was not updated.\r\n\r\n## Steps to reproduce\r\n```csharp\r\nusing (var context = new BookDbContext())\r\n{\r\n    var author = context.Authors.First();\r\n    author.Name.First = \"Lukas\";\r\n    context.SaveChanges();\r\n\r\n    author.Description = \"Some very important information\";\r\n    context.SaveChanges();    // -> DbUpdateConcurrencyException\r\n}\r\n```\r\nHere´s a [Sample Project](https://github.com/rzlsoftware/EfCoreOwnedEntitesConcurrencyProblemTest/tree/master) to reproduce the Issue.\r\n\r\n### Exception message:\r\n```\r\nDatabase operation expected to affect 1 row(s) but actually affected 0 row(s). Data may have been modified or deleted since entities were loaded. See http://go.microsoft.com/fwlink/?LinkId=527962 for information on understanding and handling optimistic concurrency exceptions.\r\n```\r\n\r\n### Stack trace:\r\n```\r\n   at Microsoft.EntityFrameworkCore.Update.AffectedCountModificationCommandBatch.ThrowAggregateUpdateConcurrencyException(Int32 commandIndex, Int32 expectedRowsAffected, Int32 rowsAffected)\r\n   at Microsoft.EntityFrameworkCore.Update.AffectedCountModificationCommandBatch.ConsumeResultSetWithPropagation(Int32 commandIndex, RelationalDataReader reader)\r\n   at Microsoft.EntityFrameworkCore.Update.AffectedCountModificationCommandBatch.Consume(RelationalDataReader reader)\r\n   at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.Execute(IRelationalConnection connection)\r\n   at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.Execute(DbContext _, ValueTuple`2 parameters)\r\n   at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerExecutionStrategy.Execute[TState,TResult](TState state, Func`3 operation, Func`3 verifySucceeded)\r\n   at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.Execute(IEnumerable`1 commandBatches, IRelationalConnection connection)\r\n   at Microsoft.EntityFrameworkCore.Storage.RelationalDatabase.SaveChanges(IReadOnlyList`1 entries)\r\n   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChanges(IReadOnlyList`1 entriesToSave)\r\n   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChanges(Boolean acceptAllChangesOnSuccess)\r\n   at Microsoft.EntityFrameworkCore.DbContext.SaveChanges(Boolean acceptAllChangesOnSuccess)\r\n   at Microsoft.EntityFrameworkCore.DbContext.SaveChanges()\r\n   at EfCoreOwnedEntitesConcurrencyProblemTest.Program.ConcurrencyProblem() in C:\\Development\\EfCoreOwnedEntitesConcurrencyProblemTest\\EfCoreOwnedEntitesConcurrencyProblemTest\\Program.cs:line 32\r\n   at EfCoreOwnedEntitesConcurrencyProblemTest.Program.Main(String[] args) in C:\\Development\\EfCoreOwnedEntitesConcurrencyProblemTest\\EfCoreOwnedEntitesConcurrencyProblemTest\\Program.cs:line 20\r\n```\r\n\r\n### Further technical details\r\nEF Core version: 2.1.1\r\nDatabase Provider: Microsoft.EntityFrameworkCore.SqlServer\r\nOperating system: Windows 10 1803\r\nIDE: Visual Studio 2017 15.7.5\r\n"}}
{"actor":{"display_login":"JakobFerdinand"}}