Skip to content

Commit f60587f

Browse files
committed
test: all passing
1 parent 0304725 commit f60587f

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/JsonApiDotNetCore/Data/DefaultEntityRepository.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,15 @@ public virtual async Task<TEntity> GetAndIncludeAsync(TId id, string relationshi
149149
public virtual async Task<TEntity> CreateAsync(TEntity entity)
150150
{
151151
AttachRelationships(entity);
152+
foreach (var relationshipEntry in _jsonApiContext.RelationshipsToUpdate)
153+
{
154+
var relationshipValue = relationshipEntry.Value;
155+
if (relationshipEntry.Key is HasManyThroughAttribute throughAttribute)
156+
{
157+
AssignHasManyThrough(entity, throughAttribute, (IList)relationshipValue);
158+
}
159+
}
160+
152161
_dbSet.Add(entity);
153162

154163
await _context.SaveChangesAsync();

test/JsonApiDotNetCoreExampleTests/Acceptance/Spec/UpdatingRelationshipsTests.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -625,7 +625,6 @@ public async Task Can_Delete_Relationship_By_Patching_Relationship()
625625
[Fact]
626626
public async Task Updating_ToOne_Relationship_With_Implicit_Remove()
627627
{
628-
629628
// Arrange
630629
var context = _fixture.GetService<AppDbContext>();
631630
var passport = new Passport();

0 commit comments

Comments
 (0)