That worked, thanks! For some reason I didn't expect it to but now I just have to say ActiveRecordMediator<Type2>.Delete(type2); and the associated type1s have their value for Type2Id set to null, which is exactly what I wanted.
2009/7/31 Markus Zywitza <[email protected]> > You have to cascade the relation (SaveUpdate). No guarantees, I have no > test code at my keyboard here. > > -Markus > > 2009/7/31 Adam Belshaw <[email protected]> > > If I have >> >> [ActiveRecord] >> public class Type1 >> { >> ... >> >> [BelongsTo] >> public Type2 Entity >> { >> get; >> set; >> } >> } >> >> [ActiveRecord] >> public class Type2 >> { >> ... >> >> [HasMany(Lazy = true)] >> public IList<Type1> Entities >> { >> get; >> set; >> } >> } >> >> and I want to delete a Type2 without deleting the associated Type1s, but >> to remove their reference to the Type2, is there a better way than saying >> >> type2.Entities.Clear(); >> ActiveRecordMediator<Type2>.Update(type2); >> ActiveRecordMediator<Type2>.Delete(type2); >> >> Ideally I would like to do this without loading the collection, perhaps >> there's some way to specify this in the attribute? >> >> Thanks, >> >> Adam. >> >> >> > > > > -- Adam Belshaw Internetware Limited Connect your Website with your Sage accounting software. Visit www.getconnect.co.uk for more information T: 0845 123 2920 F: 0845 123 2921 E: [email protected] W: www.internetware.co.uk Internetware Limited, i6, 6-8 Charlotte Square, Newcastle, NE1 4XF. Company No. 04433554. VAT Registration No. 796 5763 59 This message is intended for the designated recipient only and may contain privileged or confidential information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of the email by you is prohibited. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
