R – How to map Dictionary with Fluent Nhibernate

.netfluentnhibernate

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>

The class is like this

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

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

Best Solution

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

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.

Paul Batum