How to map Dictionary<enum1,enum2> with Fluent Nhibernate

18 views
Skip to first unread message

nike...@letterboxes.org

unread,
Oct 28, 2008, 11:39:00 AM10/28/08
to Fluent 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>

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?

nike...@letterboxes.org

unread,
Oct 29, 2008, 10:39:44 AM10/29/08
to Fluent NHibernate
Forget to add
namespace Domain {
public class OneFoo {
public virtual IDictionary<FooType, FooStatus> MyFoo
{ set; get; }
}
}

Paul Batum

unread,
Nov 1, 2008, 3:57:43 PM11/1/08
to fluent-n...@googlegroups.com
Hi there, my apologies for the late reply.

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

nike...@letterboxes.org

unread,
Nov 5, 2008, 11:03:49 AM11/5/08
to Fluent NHibernate
Thanks for the answer
> > }- Masquer le texte des messages précédents -
>
> - Afficher le texte des messages précédents -
Reply all
Reply to author
Forward
0 new messages