http://jfromaniello.blogspot.com/search?q=ghostbuster


On Feb 2, 2: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] 
> > >
> > .
> > 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