How do you map an entity -> interface relationship using Fluent NHibernate?

fluent-nhibernate, nhibernate

Solution

Try mapping the interface `IProduct` instead of the concrete class `Product`. (Note, I'm not talking about mapping the `Product` field of class `Order`.)

Problem

given the following class definition: ``` public class Order { public IProduct Product {get;set;} } ``` I have this (fluent) mapping ``` References(x=>x.Product, "ProductId"); ``` And get this exception: An association from the table Orders refers to an unmapped class, which makes sense because it doesn't know what implementation I will pass to it. I understand why I have to define the type in the mapping (IProduct could be anything) but I'm not sure how to do it. Thanks, Kyle

Original source