views:

53

answers:

2

I'm trying to do a mapping for the following classes:

public class A { 
  public virtual int Id { get; private set; }
  public virtual IDictionary<MyEnum, B> MyBValues { get; set; } 
}

public class B { 
  public virtual int Id { get; private set; }
}

public enum MyEnum { Value1, Value2, Value3 }

I'd like the resulting tables to look like this:

A
----------------
Id : int

B
----------------
Id : int

MyBValues
----------------
AId : int -- FK to A
BId : int -- FK to B
MyValue : int -- One of the enum values

Any ideas?

Thanks Andy

A: 

Have a look at this to see if it helps:

http://code.google.com/p/fluent-nhibernate/issues/detail?id=94

Pierre 303
I think it helps, but I'm getting different errors now. Probably because I'm not sure if I'm giving it the proper data.The message I'm now getting is (B is the class which is stored as the dictionary's value part of the pair):Could not determine type for: B, for columns: NHibernate.Mapping.Column(elt)
Andy
A: 

Paul, part of the Fluent team, has posted the solution on the Fluent support site: https://fluentnhibernate.tenderapp.com/discussions/help/225-mapping-a-dictionary

The only missing piece is that it complains that the enum type is an unmapped class, which may be just because we're not on the latest version (I'm guesing).

Andy

related questions