The domain:
public class BaseClassClient
{
public virtual ICollection<BaseClass> BaseObjects{ get; set; }
}
public abstract class BaseClass
{
}
public class SubClass1 : BaseClass
{
}
public class SubClass2 : BaseClass
{
}
I get the error Association references unmapped class
, even though both the sub classes are mapped. Obviously, the base class itself is not mapped. Please suggest how to solve this.
Edit
I would rather that before closing a question as a duplicate to another, they just not read, but also care to understand both the questions.
Ihave seen the question Error: fluent NHibernate mapping which references mapping in different assembly . But it talks about a different scenario.
My scenario is like below.
public class Product
{
public int Id { get; set; }
public ICollection<BasePricingRule> PricingRules{ get; set; }
}
public abstract class BasePricingRule
{
public int Id { get; set; }
//other properties
}
//Several concrete classes inherit from BasePricingRule.
I want to have one table per concrete class and no table for the base class. Therefore, there is no mapping for the BasePricingRule
. I am allowing the classes to get auto mapped, occassionally providing necessary overrides. I created an automapping override for the product class as below.
public void Override(FluentNHibernate.Automapping.AutoMapping<Product> mapping)
{
mapping.HasMany(product => product.PricingRules); //Not really sure
// about how to map this.
}
I have been seeing examples like http://ayende.com/blog/3941/nhibernate-mapping-inheritance for inheritance mappings. But these examples actually not address the issue I am facing. More than the error, I would like to know how I should map this domain via fluent NHibernate, preferably using automapping overrides.