It must have something to do with it being within a monorail session--
if I create it all then update it within a single unit test it works
fine.

On Sep 3, 8:55 am, JakeS <[email protected]> wrote:
> I've got two entities set up like so:
>
> class User
> {
>    [PrimaryKey]
>    public int ID;
>
>    //Sometimes a user doesn't own the billinginfo, someone else pays
> for them
>    [OneToOne]
>    public BillingInfo OwnedBilling{get;set;}
>
>    [BelongsTo("BilledToID")]
>    public BillingInfo BilledTo{get;set;}
>
> }
>
> class BillingInfo
> {
>    [PrimaryKey(PrimaryKeyType.Foreign)]
>    public int ID;
>    [OneToOne]
>    public User Owner{get;set;}
>    [HasMany(typeof(User))]
>    public IList<User> PaysFor{get;set;}
>
> }
>
> Now when I try to .Update() and existing BillingInfo, I get an error:
> "a different object with the same identifier value was already
> associated with the session: 4, of entity:
> Models.Billing.BillingInfo".  Most of my searches on this say I need
> to .Evict() the existing info, but so far nothing has worked:
>
> public void UpdateBillingInfo([DataBind("BillingInfo")] BillingInfo
> info)
>  {
>    SessionScope.Current.Evict(info);  //No help here
>    ActiveRecordMediator<BillingInfo>.Evict(info);  //This doesn't work
> either
>    info.UpdateAndFlush();  //Error still occurs here!
>
> }
>
> Can anyone tell what I'm doing wrong?
--~--~---------~--~----~------------~-------~--~----~
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