开发者

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

开发者 https://www.devze.com 2023-01-08 16:09 出处:网络
I\'m trying to code my domain to interfaces types rather than concrete types. Skeleton examples of two domain objects are:

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

精彩评论

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