Skip to content
Closed
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 @@ -129,7 +129,9 @@

case IProperty property:
// Shadow property materialization on complex types is not currently supported (see #35613).
if (propertyBase.DeclaringType is IComplexType && property.IsShadowProperty())
if (propertyBase.DeclaringType is IComplexType
&& property.IsShadowProperty()
&& (parameter == null || !parameter.Type.IsAssignableTo(typeof(IInternalEntry))

Check failure on line 134 in src/EFCore/ChangeTracking/Internal/SnapshotFactoryFactory.cs

View check run for this annotation

Azure Pipelines / efcore-ci (Build Linux)

src/EFCore/ChangeTracking/Internal/SnapshotFactoryFactory.cs#L134

src/EFCore/ChangeTracking/Internal/SnapshotFactoryFactory.cs(134,104): error CS1026: (NETCORE_ENGINEERING_TELEMETRY=Build) ) expected

Check failure on line 134 in src/EFCore/ChangeTracking/Internal/SnapshotFactoryFactory.cs

View check run for this annotation

Azure Pipelines / efcore-ci (Build macOS)

src/EFCore/ChangeTracking/Internal/SnapshotFactoryFactory.cs#L134

src/EFCore/ChangeTracking/Internal/SnapshotFactoryFactory.cs(134,104): error CS1026: (NETCORE_ENGINEERING_TELEMETRY=Build) ) expected

Check failure on line 134 in src/EFCore/ChangeTracking/Internal/SnapshotFactoryFactory.cs

View check run for this annotation

Azure Pipelines / efcore-ci

src/EFCore/ChangeTracking/Internal/SnapshotFactoryFactory.cs#L134

src/EFCore/ChangeTracking/Internal/SnapshotFactoryFactory.cs(134,104): error CS1026: (NETCORE_ENGINEERING_TELEMETRY=Build) ) expected
{
arguments[i] = propertyBase.ClrType.GetDefaultValueConstant();
types[i] = propertyBase.ClrType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,62 @@ public class OptionalComplexProperty

#endregion Issue37337

#region Issue37914

[ConditionalFact]
public virtual async Task Update_entity_with_nullable_complex_type_and_discriminator()
{
var contextFactory = await InitializeAsync<Context37914>(
seed: context =>
{
context.Add(
new Context37914.EntityType
{
Prop = new Context37914.OptionalComplexProperty
{
OptionalValue = true
}
});
return context.SaveChangesAsync();
});

await using var context = contextFactory.CreateContext();

var entity = await context.Set<Context37914.EntityType>().SingleAsync();
Assert.NotNull(entity.Prop);
Assert.True(entity.Prop.OptionalValue);

context.Update(entity);
await context.SaveChangesAsync();
}

private class Context37914(DbContextOptions options) : DbContext(options)
{
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
var entity = modelBuilder.Entity<EntityType>();
entity.Property(p => p.Id);
entity.HasKey(p => p.Id);

var compl = entity.ComplexProperty(p => p.Prop);
compl.Property(p => p.OptionalValue);
compl.HasDiscriminator();
}

public class EntityType
{
public Guid Id { get; set; }
public OptionalComplexProperty? Prop { get; set; }
}

public class OptionalComplexProperty
{
public bool? OptionalValue { get; set; }
}
}

#endregion Issue37914

protected override string NonSharedStoreName
=> "AdHocComplexTypeQueryTest";
}
Loading