We have hit a problem with AR generating the mappings for a Composite User Type embedded within a joined sub-class. Simply a property defined [CompositeUserType] on a class that is not the hierachy of the base will not be mapped out to a property. Switch that property to the base and it maps as required.
The following code is an example (I have not included the composite user type for space, but happy to send on request). The composite user type generates correctly (confirmed from the hbm.xml files if it is on the base, not if it is on the derived class.
Anyone come across this and know if there is a fix.
using System;
using Castle.ActiveRecord;
using
Matlock.Core.Proposals.ProposalStates;
[ActiveRecord(Lazy = true)]
public class LittleTest : LittleBase
{
private IProposalState currentState;
[JoinedKey]
public virtual int LittleTestId { get; set;
}
[CompositeUserType(typeof(ProposalStateUserType), new[] { "State_Name", "State_EnteredOn", "State_ChangedBy" })]
public virtual IProposalState CurrentState
{
get
{
return currentState;
}
set
{
currentState = value; currentState.EnteredOn =
DateTime.Now;
}
}
}
[ActiveRecord("LittleBase", Lazy = true), JoinedBase]
public class LittleBase
{
[PrimaryKey]
public virtual int Id { get; set; }
[Version]
public virtual int Version { get; set; }
}
Ian Cooper