Sorry folks, I did not realize this got a bit confounded in
formatting.
The actual fluent nhibernate code and corresponding generated hbm.xml
code is below.
For an IDictionary<int,int>:
HasMany(x => x.IntDict)
.AsMap<int>("Key")
.Element("Value")
;
<map name="IntDict">
<key>
<column name="Node_id" />
</key>
<index type="System.Int32, mscorlib, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089">
<column name="Key" />
</index>
<element type="System.Int32, mscorlib, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089">
<column name="Value" />
</element>
</map>
And for an IDictionary<SomeEntity,SomeEntity>:
HasManyToMany(x => x.EntityDict)
.AsMap("Key")
.AsTernaryAssociation("Key", "Value")
;
<map name="EntityDict">
<key>
<column name="Node_id" />
</key>
<index-many-to-many class="ClassLibrary1.TernaryJoy.SomeEntity,
ClassLibrary1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null">
<column name="Key" />
</index-many-to-many>
<many-to-many class="ClassLibrary1.TernaryJoy.SomeEntity,
ClassLibrary1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null">
<column name="Value" />
</many-to-many>
</map>
And an IDictionary<SomeEntity,int>:
// the fluent code remains a mystery... anybody?
<map name="HybridDict">
<key column="Entity_Id" />
<index-many-to-many class="SomeEntity" column="SomeEntity_Id"/
>
<element column="Value" type="int"/>
</map>
On Aug 31, 4:18 am, Fost andy <[email protected]> wrote:
> I forgot to mention, this is with 1.0 RTM
>
> On Aug 31, 4:16 am, Fost andy <[email protected]> wrote:
>
> > Given an IDictionary<SomeEntity, int> Foo; I'm basically trying to
> > produce this hbm.xml in fluent:
>
> > <map name="Foo">
> > <key column="..." />
> > <index-many-to-many class="SomeEntity" column="SomeEntity_Id"/>
> > <element column="Value" type="int"/>
> > </map>
>
> > After some experimentation I seem to be able to produce mappings for
> > an IDictionary<SomeEntity, SomeEntity>:
>
> > // produce a <map> with <index-many-to-many> and <many-to-many>,
> > HasManyToMany(x => x.Foo)
> > .AsMap
> > .AsTernaryAssociation("Key2", "Value")
> > ;
>
> > And for an IDictionary<int, int>:
>
> > // produce a <map> with <index> and <element>HasMany(x => x.Foo)
> > .AsMap<int>
> > .Element("Value")
> > ;
>
> > I even seem to be able to use AsIndexedCollection to produce <map>
> > with <index> and <many-to-many> (although none that NHibernate will
> > accept)
>
> > But I can't figure out how to produce a <map> with <index-many-to-
> > many> and <element>. Can someone provide some tips?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Fluent NHibernate" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/fluent-nhibernate?hl=en
-~----------~----~----~----~------~----~------~--~---