Use the UnsavedValue of the PrimaryKey attribute:
http://fisheye2.atlassian.com/browse/castleproject/trunk/ActiveRecord/Castle.ActiveRecord/Attributes/PrimaryKeyAttribute.cs?r=5688#l192

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