You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is detailed info about Support for complex entities, whose properties are another objects from issue #8.
The goal
We want to load (and save) from database entities with complex properties. Complex property is a property which is another object. In its simplest form, say we have this entity Invoice:
And we want to automatically map it to table with these columns:
Id
InvoiceNumber
SupplierStreet
SupplierCity
SupplierCountry
PurchaserStreet
PurchaserCity
PurchaserCountry
What/how should work
Complex properties with injector set must not be flattened.
Column name will be defined as concatenated names of properties: Supplier.Street -> SupplierStreet
Deep flattening of properties: Invoice.Supplier.Address.Street -> SupplierAddressStreet
Setting specific column name for nested property: .Property(p => p.Supplier.Address.Street).HasColumnName("SupplierStreet")
Complex properties can be readonly ({ get; }) or read/write ({ get; set; }).
If the property is null, instance should be created automatically if it is possible (property is r/w and property's type has parameterless constructor).
Can set nested properties as not mapped: .Property(p => p.Supplier.Country).NoMap()
Can use injectors for nested properties: .Property(p => p.Supplier.Country).InjectValue(...)
Update readme.
Other considerations
Should flattening work automatically and be turned off if not wanted, or vice versa?
We will support only fluent configurations for this (no attributes).
Can we make whole attribute configuration obsolete?
The text was updated successfully, but these errors were encountered:
This is detailed info about Support for complex entities, whose properties are another objects from issue #8.
The goal
We want to load (and save) from database entities with complex properties. Complex property is a property which is another object. In its simplest form, say we have this entity
Invoice
:And we want to automatically map it to table with these columns:
What/how should work
Supplier.Street -> SupplierStreet
Invoice.Supplier.Address.Street -> SupplierAddressStreet
.Property(p => p.Supplier.Address.Street).HasColumnName("SupplierStreet")
{ get; }
) or read/write ({ get; set; }
).null
, instance should be created automatically if it is possible (property is r/w and property's type has parameterless constructor)..Property(p => p.Supplier.Country).NoMap()
.Property(p => p.Supplier.Country).InjectValue(...)
Other considerations
The text was updated successfully, but these errors were encountered: