Skip to content

Commit

Permalink
Try UpdateFromQuery
Browse files Browse the repository at this point in the history
  • Loading branch information
virzak committed Feb 19, 2022
1 parent db4e744 commit 0580263
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions OwnedEntityWithUniqueIndex/Child.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ public class Child
public Guid Id { get; set; }

public Guid ParentId { get; set; }
public string? Description { get; set; }
public Parent Parent { get; set; } = null!;
public Owned Owned { get; set; } = new();
}
7 changes: 7 additions & 0 deletions OwnedEntityWithUniqueIndex/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
var child = new Child
{
Id = Guid.NewGuid(),
Description = "123",
ParentId = parent.Id,
Owned = new() { Value = 3 }
};
Expand All @@ -26,3 +27,9 @@

context.BulkInsert(new[] { child });
}

using (var context = new OwnedEntityContext())
{
context.Children
.UpdateFromQuery(f => new Child { Description = "456" });
}

0 comments on commit 0580263

Please sign in to comment.