如何映射字典< enum1,enum2>与功能NHibernate [英] How to map Dictionary<enum1,enum2> with Fluent Nhibernate

查看:158
本文介绍了如何映射字典< enum1,enum2>与功能NHibernate的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是使用类似映射关系如下

I was mapping a relation using something like the following

<map name="Foo" cascade="all-delete-orphan" lazy="false">
  <key column="FooId"/>
  <index column="FooType" type="Domain.Enum.FooType, Domain"/>
  <element column ="FooStatus" type="Domain.Enum.FooStatus, Domain"/>
</map>

类是像这样

namespace Domain {
    public class Enum {
        public enum FooType {
            Foo1,
            Foo2,
            ...
      Foo50}
       public enum FooStatus {
           NotNeeded,
           NeededFor1,
           NeededFor2,
      NeededFor3,
      NiceToHave}
    }
}

我可以做到这一点使用功能NHibernate? 如果没有,我可以映射一类混合流利和XML?

Can I do this using Fluent Nhibernate? If not can I map a class mixing Fluent and XML?

推荐答案

回答流利的NHibernate谷歌组是我问同样的问题

ANSWER From Fluent NHibernate Google group were I asked the same question

简短的答案是否定的,你不能用在流畅的界面做到这一点 时刻。我最初的AsMap()的实现是相当幼稚和不 支持您的方案。我会提出这是个问题,并送还给你一次 一个解决办法是在地方,但在此期间,你应该能够解决它 通过将XML用流利的映射。我知道我们有几个用户是 目前做这个。具体步骤将取决于你是如何将它设置 向上。

The short answer is no, you cannot do this with the fluent interface at the moment. My initial implementation of AsMap() was rather naive and does not support your scenario. I will raise it as an issue and get back to you once a fix is in place but in the meantime you should be able to work around it by mixing xml with fluent mappings. I know we have several users that are currently doing this. The exact steps would depend on how you have it set up.

保罗 - 巴图姆

这篇关于如何映射字典&LT; enum1,enum2&GT;与功能NHibernate的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆