and the right node is <map-key> and not <index>.
<index> is there only for back draw compatibility with old versions of our
big brother (Hibernate)

With NH300 (UhAh!!) you can use : EnumType<TEnum>

P.S. who will guess what "UhAh" is for ?

On Thu, Feb 3, 2011 at 12:30 AM, Trinition <[email protected]> wrote:

> Awesome.  Based on your tip, I've just read dozens of stackoverflows,
> blogs, etc. about this.  I understand some of this, but now I think
> FluentNH is getting in my way.  I can't seem to simply *omit* the type
> and let NH work it's magic.
>
> The first FluentNH-generated mapping was...
>
>    <index type="System.Int32" ...
>
> This stemmed from...
>
>    .AsMap<System.Int32>("AddressTypeID") // on HasMany(...)
>
> I tried omitting the generic type, but FluentNH's mappings still drove
> to System.Int32.  Then I tried
> AsMap<MyProject.AddressTypeEnum>("AddressTypeID"), and that produced:
>
>    <index type="MyProject.AddressTypeEnum" ...
>
> I also tried a FluentNH conection that does the same thing by looking
> at the property's type.
>
> Yet everything I read says I need to *omit* the type from the mapping,
> which at first glance, FluentNH doesn't seem willing to do.
>
> I'm going to re-trace my steps to make sure I didn't miss anything.
>
> Thanks!
>
>
> On Feb 2, 5:35 pm, Fabio Maulo <[email protected]> wrote:
> > Enum != Int32
> > a classic Ghost
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > On Wed, Feb 2, 2011 at 7:05 PM, Trinition <[email protected]> wrote:
> > > I searched everywhere, including this group, about NH deleting and
> > > then re-inserting rows in a collection, but every result I found was
> > > about using bags or lists without an index.  I don't believe that is
> > > my situation because I'm using a <map/>.
> >
> > > I have Contacts, Addresses and ContactAddresses tables -- the latter
> > > being a join table with ContactID, AddressTypeID.  In code, Contact
> > > has an IDictionary<AddressTypeEnum,Address> (and I'm mapping the enum
> > > as an Int).  Here's my mapping:
> >
> > >    <!-- excerpted from FluentNH-generated mapping for Contact ... >
> > >    <map cascade="all" lazy="true" name="Addresses"
> > > table="tblContactAddresses" mutable="true">
> > >      <key>
> > >        <column name="ContactID" />
> > >      </key>
> > >      <index type="System.Int32, mscorlib, Version=4.0.0.0,
> > > Culture=neutral, PublicKeyToken=b77a5c561934e089">
> > >        <column name="AddressTypeID" />
> > >      </index>
> > >      <many-to-many class="MyProject.Address, MyProject,
> > > Version=1.0.0.0, Culture=neutral, PublicKeyToken=null">
> > >        <column name="AddressID" />
> > >      </many-to-many>
> > >    </map>
> >
> > > Using NHProf, I can clearly see it deleting all ContactAddress rows
> > > for a Contact, and then re-inserting them (example shows contact who
> > > happens to have only a single address):
> >
> > > DELETE FROM dbo.tblContactAddresses WHERE       ContactID = 1 /* @p0
> > > */
> >
> > > INSERT INTO dbo.tblContactAddresses
> > >           (ContactID, AddressTypeID, AddressID)
> > > VALUES     (1 /* @p0 */, 'Home' /* @p1 */, 270 /* @p2 */)
> >
> > > From the other search results about bags and lists-without-index, I
> > > gather that if NH can't determine the identity of an item in the
> > > collection, it will do this.  But there's two things I can't
> > > understand about that in my situation:
> >
> > > 1. Shouldn't AddressTypeEnum and the Address' identity be a unique
> > > combination for the collections o that NH can't identify individual
> > > items?
> > > 2. I'm not actually touching anything in my collection!  I'm just
> > > fetching it, transforming the entity data into DTOs, and then closing
> > > my unit of work.
> >
> > > I'd appreciate any insights, or even additional debugging tips.
> >
> > > P.S. I only recently discovered NHProf and I'm blown away by it...
> > > awaiting a PO!
> >
> > > --
> > > 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]<nhusers%[email protected]>
> <nhusers%[email protected]<nhusers%[email protected]>>
> > > .
> > > For more options, visit this group at
> > >http://groups.google.com/group/nhusers?hl=en.
> >
> > --
> > Fabio Maulo
>
> --
> 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]<nhusers%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/nhusers?hl=en.
>
>


-- 
Fabio Maulo

-- 
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.

Reply via email to