Nhibernate Mapping接口

时间:2011-10-06 13:38:47

标签: interface fluent-nhibernate nhibernate-mapping

如何使用流畅的Nhibernate

映射界面
class Product {

public virtual IProductStructure ProductStructure { get; set; }

}


 public class ProductMap : SubclassMap<Product>
    {
        public ProductMap()
        {
            HasOne(x => x.IProductStructure).PropertyRef(x => x.Product).Cascade.All();
        }
    }

public interface IProductStructure
    {
        Product Product { get; set; }
    }

错误:NHibernate.MappingException:property-ref为unmapped类:..... Test.IStructure 谢谢。

1 个答案:

答案 0 :(得分:0)

您的映射需要是具体的类。在您的情况下,IProductStructure

的实施