Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ public ColumnMetadata(IProperty property, SqlDialectBuilder dialect, IComplexPr
QuotedColumName = dialect.Quote(ColumnName);
StoreDefinition = GetStoreDefinition(property);
ClrType = property.ClrType;
IsGenerated = property.ValueGenerated != ValueGenerated.Never;
IsGenerated = property.ValueGenerated != ValueGenerated.Never
&& (property.GetDefaultValueSql() != null
|| property.GetComputedColumnSql() != null
|| property.FindAnnotation(RelationalAnnotationNames.DefaultValue) != null
|| (property.ClrType != typeof(Guid) && property.ClrType != typeof(Guid?)));
Comment on lines +25 to +28
}

private readonly Func<object, object?> _getter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,6 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
.HasConversion(new DateTimeToBinaryConverter());
});

modelBuilder.Entity<TestEntityWithGuidId>(builder =>
{
builder.Property(e => e.Id)
.ValueGeneratedNever();
});

modelBuilder.Entity<TestEntityWithComplexType>(builder =>
{
builder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -314,15 +314,12 @@ public async Task InsertEntities_WithGeneratedGuidId(InsertStrategy strategy)
new TestEntityWithGuidId { TestRun = _run, Id = Guid.NewGuid(), Name = $"{_run}_Entity2" }
};

// Act
var insertedEntities = await _context.InsertWithStrategyAsync(strategy, entities, configure => configure.CopyGeneratedColumns = true);
// Act - Guid PKs should be included in INSERT without requiring CopyGeneratedColumns = true
var insertedEntities = await _context.InsertWithStrategyAsync(strategy, entities);

// Assert
// Assert - all fields including the application-assigned Guid Id should be preserved
insertedEntities.Should().BeEquivalentTo(entities,
o=> o
.RespectingRuntimeTypes()
.Excluding(e => e.Id)
);
o => o.RespectingRuntimeTypes());
Comment on lines 321 to +322
}

[SkippableTheory]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ public async Task InsertEntities_MultipleTimes_WithGuidId(InsertStrategy strateg
Update = (inserted, excluded) => inserted,
});

// Assert
// Assert - all fields including the application-assigned Guid Id should be preserved
insertedEntities.Should().BeEquivalentTo(entities,
o => o.RespectingRuntimeTypes().Excluding(e => e.Id));
o => o.RespectingRuntimeTypes());
}

[SkippableTheory]
Expand Down
Loading