I can't figure out what's wrong here. I've got a Many To Many between 2 classes with an association class in the middle. When I remove the association class from the list and save, it's still there.
It would seem to be a cascade issue, but these should be right. I can add with no problem, just not delete. I'm trying to delete form the Customer class right now. I am following the config from this post, http://www.aaronstannard.com/post/2010/12/24/fluent-nhibernate-bidirectional-many-to-many.aspx, which talks about my exact situation. Classes: -------------- public class Customer { protected virtual IList<CustomerCarrier> _carriers { get; set; } public virtual void AddCarrier(Carrier carrier) { var cc = new CustomerCarrier() { Customer = this, Carrier = carrier }; this._carriers.Add(cc); } public virtual void RemoveCarrier(Carrier carrier) { var customerCarrier = _carriers.FirstOrDefault(x => x.Carrier == carrier); if (customerCarrier != null) { _carriers.Remove(customerCarrier); } } public virtual ReadOnlyCollection<Carrier> Carriers { get { return new ReadOnlyCollection<Carrier>( _carriers.Select(x => x.Carrier).ToList()); } } } public class Carrier { protected virtual IList<CarrierSetting> _carrierSettings { get; set; } public virtual ReadOnlyCollection<Customer> Customers { get { return new ReadOnlyCollection<Customer>( _customerCarriers.Select(x => x.Customer).ToList() ); } } public virtual void AddCustomer(Customer customer) { var customerCarrier = new CustomerCarrier() { Customer = customer, Carrier = this }; _customerCarriers.Add(customerCarrier); } public virtual void RemoveCustomer(Customer customer) { var customerCarrier = _customerCarriers.Where(x => x.Customer == customer) .FirstOrDefault(); if (customerCarrier != null) { _customerCarriers.Remove(customerCarrier); } } } public partial class CustomerCarrier : TrackableEntity { public CustomerCarrier() { } public virtual int CustomerCarrierID { get; protected set; } public virtual Customer Customer { get; set; } public virtual Carrier Carrier { get; set; } } Here's the relevant mapping for these classes: CustomerMap HasMany<CustomerCarrier>( Reveal.Member<Customer>("_carriers") ) .Cascade.AllDeleteOrphan() .Fetch.Join() .Inverse() .KeyColumn("CustomerID") ; CarrierMap HasMany<CustomerCarrier>( Reveal.Member<Carrier>("_customerCarriers") ) .Cascade.AllDeleteOrphan() .Fetch.Join() .Inverse() .KeyColumn("CarrierID") ; CustomerCarrierMap References(x => x.Customer) .Not.Nullable() .Cascade.SaveUpdate() .Column("CustomerID") ; References(x => x.Carrier) .Not.Nullable() .Cascade.SaveUpdate() .Column("CarrierID") ; -- You received this message because you are subscribed to the Google Groups "Fluent NHibernate" group. To post to this group, send email to fluent-nhibernate@googlegroups.com. To unsubscribe from this group, send email to fluent-nhibernate+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/fluent-nhibernate?hl=en.