开发者

Nhibernate Mapping interface

How to map an interface using fluent 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; }
    }

error : N开发者_StackOverflowHibernate.MappingException : property-ref to unmapped class: .....Test.IStructure thanks .


Your mapping needs to be to a concrete class. In your case to the implementation of IProductStructure.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜