Issue with ComplexType when using EFCore 8.0
I've come across an issue with ComplexType' properties used in aggregated properties of an entity. When saving an entity that has another entity as property with the Aggregationattribute and that entity has aComplexType` property (new in EFCore 8.0, see this) then I get a null reference exception on mapping the main entity.
I think the offending line is 62: https://github.com/leonardoporro/Detached-Mapper/blob/6b5c0a40708fe84a673f5f9802661da847527c50/src/Detached.Mappers/TypeMappers/Entity/Complex/EntityTypeMapperFactory.cs#L59-L63
The mapper only maps primitives for aggregated types, which was fine before because any complextype-like usage were OwnedTypes that had a (shadow) key and would be mapped using the keyMembers mapper.
Now with the new ComplexType of EFCore 8.0 those objects don't have a key anymore but are also not primitives.
Is solved this by changing line 62 into this:
return mapper.Options.GetType(t.ClrType).IsPrimitive() || mapper.Options.GetType(t.ClrType).IsComplex();
I see no ill effects as of yet but I'd like to know your thoughts in this.
Owned has problems. I'm working on a refactor to better support this.
I think it's ok, but would be good to make it configurable: AggregationMapFields { Key, KeyAndPrimitives...