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

后端 未结 4 1139
太阳男子
太阳男子 2021-01-05 07:38

given the following class definition:

public class Order {
  public IProduct Product {get;set;}
}

I have this (fluent) mapping



        
4条回答
  •  春和景丽
    2021-01-05 08:31

    I've been working on improving the support for proxy interfaces in Fluent. There were a couple of useful patches attached to issues 256 and 257, but they really needed everything specified manually. I've taken these a step further and added support for setting proxies and changing the types of references from the inferred (which would be the proxy) to the underlying mapped class, and added a new convention (ProxyConvention) to set it all up automatically - just instantiate it with a function to derive the proxy interface from a mapped class, and it should take care of the rest.

    The one loophole at the moment is that it can't pick up any definitions specified explicitly in .hbm.xml files.

    The patch is attached to issue 256

提交回复
热议问题