Component has bag of child components. Child property mapping ignored
Description
Environment
None
Attachments
1
Activity
Show:
Andrew Shepherd November 28, 2016 at 9:50 PM
I have submitted a fix to this defect as pull request 534.
Andrew Shepherd October 19, 2016 at 9:52 PM
Added a test case as an attachment. (This is my first interaction with the NHibernate development site, so hopefully I've followed the convention well enough).
Who's Looking?
My entity holds a component, and this component has a bag of child components.
My child component has a property, the name of which differs from the corresponding database column.
I explicitly set the database column name, but this is ignored. It attempts to access the data using the class's property name, not the column name.
Here is the actual bag mapping code. I have a property called "Address" which is supposed to map to the "EmailAddress" column. The nHIbernate code would attempt to use a column with the name of "Address"
componentMapper.Bag(mc => mc.Recipients,
bagPropertyMapper =>
{
bagPropertyMapper.Table("CompanyMailRecipient");
bagPropertyMapper.Key(mrKeyMapper =>
{
mrKeyMapper.Column("Company_Id");
});
},
r => r.Component(
mrc =>
{
mrc.Property
(
mr => mr.Name,
mrpm => mrpm.Column("Name")
);
/*****************************/
/* Here's the important bit */
/*****************************/
mrc.Property
(
mr => mr.Address,
mrpm => mrpm.Column("EmailAddress");
);
mrc.Property
(
mr => mr.DestinationType,
mrpm => mrpm.Column("DestinationType")
);
};
)