[PrimaryKey(UnsavedValue = "-1")]

Make sure this value is the default for your PK property. When you do
"new MyEntity()" the PK property has to be -1

On Sep 17, 12:21 pm, Chris Curvey <[email protected]> wrote:
> Thanks for the info, Mauricio.  Could I ask how to "use the
> UnsavedValue attribute of the PrimaryKey attribute"?  I'm trying to
> use AR to avoid having to write NHibernate's XML, and all the
> references I'm finding to unsaved-value deal in XML.
>
> On Sep 17, 11:13 am, Mauricio Scheffer <[email protected]>
> wrote:
>
>
>
> > See also:http://www.google.com/search?q=%2Bnhibernate+%2Bunsaved-value
>
> > On Sep 17, 12:11 pm, Mauricio Scheffer <[email protected]>
> > wrote:
>
> > > Use the UnsavedValue of the PrimaryKey 
> > > attribute:http://fisheye2.atlassian.com/browse/castleproject/trunk/ActiveRecord...
>
> > > On Sep 17, 12:01 pm, Chris Curvey <[email protected]> wrote:
>
> > > > I have two classes...Envelope and LetterType.  Envelope references
> > > > LetterType, and they both have numeric (identity) keys.
>
> > > > I have this in my code (which is assigning a letter type based on a
> > > > drop-down list)
>
> > > > currentEnvelope.LetterType = letterTypes
> > > > [letterTypeList.SelectedValue];
> > > > currentEnvelope.Update()
>
> > > > This works fine, UNLESS the ID of the letter type is zero.  All other
> > > > letter types work fine.  There is, in fact, a letter type with the
> > > > value of zero in my database table.  (it was put there on  purpose.)
>
> > > > Oh bleep.  Does AR think that an instance has not been saved if it has
> > > > a zero ID?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" 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/castle-project-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to