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
Currently, the query source generator only supports mapping single columns to properties. However, there are cases where we need to map multiple columns into a single value object property, especially when dealing with value objects that encapsulate related data.
For example, when mapping person names into a PersonName value object:
-- // Current approach (multiple result properties):-- @result string given_name-- @result string family_name-- // Desired approach (single value object property):-- @result PersonName name { given_name, family_name }SELECTperson.given_name,
person.family_nameFROM people
MyNamespace.ValueObject is the fully qualified type name
property_name is the name of the property in the result object in snake_case. It should transform to CamelCase automatically
{ column1, column2, ... } are the column names
Note on NHibernate Implementation
When using the NHibernate implementation, these value objects are mapped using ICompositeUserType. This interface allows NHibernate to handle the mapping of multiple columns into a single value object.
The text was updated successfully, but these errors were encountered:
Description
Currently, the query source generator only supports mapping single columns to properties. However, there are cases where we need to map multiple columns into a single value object property, especially when dealing with value objects that encapsulate related data.
For example, when mapping person names into a
PersonName
value object:Use Cases
Proposed Syntax
-- @result MyNamespace.ValueObject property_name { column1, column2, ... }
Where:
MyNamespace.ValueObject
is the fully qualified type nameproperty_name
is the name of the property in the result object in snake_case. It should transform to CamelCase automatically{ column1, column2, ... }
are the column namesNote on NHibernate Implementation
When using the NHibernate implementation, these value objects are mapped using
ICompositeUserType
. This interface allows NHibernate to handle the mapping of multiple columns into a single value object.The text was updated successfully, but these errors were encountered: