Hello,
I am having a lot of issues while mapping a class with an IDictionary
using mapping by code.
Maping a dictionary like:
public virtual IDictionary<Bar, string> Bars { get; set; }
with...
Map(x => x.Bars, m => {}, k => k.ManyToMany(), v => v.Element(m =>
{}))
produces this xml:
<map name="Bars" table="BarsToFoos">
<key column="FooId" />
<map-key-many-to-many class="Bar" />
<many-to-many class="System.String, ..." column="StringId" />
</map>
There is no way I can produce this xml:
<map name="Bars" table="BarsToFoos">
<key column="FooId" />
<index-many-to-many class="Bar" />
<many-to-many class="System.String, ..." column="StringId" />
</map>
Same happens when I map a plain dictionary like this:
public virtual IDictionary<string, string> Bars { get; set; }
using:
Map(x => x.Bars,
c =>
{
c.Key(k => k.NotNullable(true));
c.Table("BarTable");
},
k => k.Element(e => { e.Column("BarId"); e.Length(5); }),
r => r.Element(e => e.Length(50)));
The above produces this:
<map name="Bars" table="BarTable">
<key column="FooId" not-null="true" />
<map-key column="BarId" type="String" length="5" />
<element column="Bar" type="String" length="50" />
</map>
Again, there is no way to produce this xml:
<map name="Bars" table="BarTable">
<key column="FooId" not-null="true" />
<index column="BarId" type="String" length="5" />
<element column="Bar" type="String" length="50" />
</map>
Even if I go with the above dictionary, the first time the object is
saved perfectly. It even loads perfectly. But once you try to update,
NH throws "No persister for: FooProxy". I am stumped. Don't know what
to do. Please help.
PS:
I filed a bug report for the first issue [NH-3102]
I am using a custom mapper to modify the naming patterns.
--
You received this message because you are subscribed to the Google Groups
"nhusers" 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/nhusers?hl=en.