开发者

Nhibernate Mapping interface

开发者 https://www.devze.com 2023-04-10 23:08 出处:网络
How to map an interface using fluent Nhibernate class Product { public virtual IProductStructure ProductStructure { get; set; }

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

精彩评论

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

关注公众号