Table Per Subclass one-to-many mapping for collection on the abstract base class [Help]
Hi,
Below is a simplified version of our domain. We would like to know how to map the "Fines" property shown on the Debt parent class using the table per sub class inheritance strategy. We use FluentNhibernate.AutoMapping components to do our mappings.
This implementation doesn't seem to work for us, any help would be greatly appreciated. Thanks!
We have the following override for the Fines property defined for the Debt class:
public class DebtOverrides : IAutoMappingOverride
{
public void Override(AutoMapping<Debt> mapping)
{
mapping.HasMany(x => x.Fines).Cascade.All();
}
}
And these are the domain entites:
namespace Domain
{
public abstract class Entity
{
public int Id { get; set; }
}
public class Fine : Entity
{
public decimal Amount { get; set; }
}
public abstract class Debt : Entity
{
public decimal Balance { get; set; }
public IEnumerable<Fine> Fines { get; set; }
}
public class CarLoan : Debt
{
public string CarModel { get; set; }
}
public class CreditCard : Debt
{
public string Creditor { get; set; }
}
}
Regards,
Vern
2 Posted by Tim Barber on 14 Jun, 2010 04:14 PM
I've been having a similar problem... I'll look at any posts with interest.
Tim