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 an Association references unmapped class error message, although both subclasses are displayed. Obviously, the base class is not displayed. Please suggest how to solve this.
Edit
I would prefer that before closing the question as a duplicate to another, they simply do not read, but also need to understand both questions.
I saw the Error: free NHibernate mapping, which refers to a mapping in another assembly . But this is a different scenario.
My script is similar to below.
public class Product { public int Id { get; set; } public ICollection<BasePricingRule> PricingRules{ get; set; } } public abstract class BasePricingRule { public int Id { get; set; }
I want to have one table for a specific class and a table for a base class. Therefore, there is no mapping for BasePricingRule . I allow classes to automatically display, sometimes providing the necessary overrides. I created an automatic override for the product class as shown below.
public void Override(FluentNHibernate.Automapping.AutoMapping<Product> mapping) { mapping.HasMany(product => product.PricingRules);
I saw examples, for example http://ayende.com/blog/3941/nhibernate-mapping-inheritance for inheritance mappings. But these examples do not actually address the problem I am facing. More than an error, I would like to know how I should map this domain using free NHibernate, preferably using automaton overrides.
source share