src/Inflatable/Sessions/Commands/DeleteCommand.cs
/// <summary>
/// Cascades the many to many properties.
/// </summary>
/// <param name="object">The object.</param>
/// <param name="source">The source.</param>
/// <param name="batch">The batch.</param>
/// <param name="objectsSeen">The objects seen.</param>
/// <param name="ParentMappings">The parent mappings.</param>
Cascades the many to many properties.
Cascades the many to many properties .
private void CascadeManyToManyProperties(object @object, IMappingSource source, SQLHelper batch, IList<object> objectsSeen, IEnumerable<Inflatable.Interfaces.IMapping> ParentMappings)
        {
            foreach (var ManyToManyProperty in ParentMappings.SelectMany(x => x.ManyToManyProperties).Where(x => x.Cascade))
            {
                var ManyToManyValue = ManyToManyProperty.GetValue(@object);
                if (ManyToManyValue != null)
                {
                    if (!(ManyToManyValue is IList ManyToManyValueList))
                        continue;
                    var FinalList = new List<object>();
                    for (int x = 0, ManyToManyValueListCount = ManyToManyValueList.Count; x < ManyToManyValueListCount; ++x)
                    {
                        var Item = ManyToManyValueList[x];
                        FinalList.Add(Item);
                    }
                    DeleteJoins(@object, source, batch, ManyToManyProperty, ManyToManyValueList);
                    for (int x = 0, FinalListCount = FinalList.Count; x < FinalListCount; ++x)
                    {
                        var Item = FinalList[x];
                        Delete(Item, source, batch, objectsSeen);
                    }
                }
            }
        }
private void CascadeManyToManyProperties ( object @object , IMappingSource source , SQLHelper batch , IList < object > objectsSeen , IEnumerable < Inflatable . Interfaces . IMapping > ParentMappings ) { foreach ( var ManyToManyProperty in ParentMappings . SelectMany ( x => x . ManyToManyProperties ) . Where ( x => x . Cascade ) ) { var ManyToManyValue = ManyToManyProperty . GetValue ( @object ) ; if ( ManyToManyValue != null ) { if ( ! ( ManyToManyValue is IList ManyToManyValueList ) ) continue ; var FinalList = new List < object > ( ) ; for ( int x = 0 , ManyToManyValueListCount = ManyToManyValueList . Count ; x < ManyToManyValueListCount ; ++ x ) { var Item = ManyToManyValueList [ x ] ; FinalList . Add ( Item ) ; } DeleteJoins ( @object , source , batch , ManyToManyProperty , ManyToManyValueList ) ; for ( int x = 0 , FinalListCount = FinalList . Count ; x < FinalListCount ; ++ x ) { var Item = FinalList [ x ] ; Delete ( Item , source , batch , objectsSeen ) ; } } } }
Cascades the many to many properties.
Cascades the many to many properties .
@object
object
source
IMappingSource
None
batch
SQLHelper
None
objectsSeen
IList<object>
The objects seen.
The objects seen .
ParentMappings
IEnumerable<Inflatable.Interfaces.IMapping>
The parent mappings.
The parent mappings .
object
None