开发者

Fluent NHibernate mappings for Domain objects with interface typed reference (in a S#arp arch app)

I'm trying to code my domain to interfaces types rather than concrete types.

Skeleton examples of two domain objects are:

public class Supplier : ISupplier
{
   public virtual IContract Contract {get; 开发者_C百科set;}
}

public class Contract : IContract
{
   public virtual List<ISuppliers> Suppliers {get; set;}
}

Is there a way to Fluently map my supplier so that it will cast to concrete domain objects for data access?

I currently get the error

NHibernate.MappingException: An association from the table Supplier refers to an unmapped class: IContract

With the following supplierMap

References(x => x.Contract).Column("ContractId")


Try:

References<Contract>(x => x.Contract).Column("ContractId");

From here.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜