internal Mappings WithFailed(Mapping mapping) { var created = Created.Contains(mapping) ? Array.AsReadOnly(Created.Where(t => t != mapping).ToArray()) : Created; var failed = !Failed.Contains(mapping) ? Array.AsReadOnly(Failed.Concat(new[] { mapping }).ToArray()) : Failed; var pending = Pending.Contains(mapping) ? Array.AsReadOnly(Pending.Where(t => t != mapping).ToArray()) : Pending; return(new Mappings(created, pending, failed)); }
internal Mappings Remove(Mapping mapping, out bool wasCreated) { wasCreated = Created.Contains(mapping); var created = Created.Contains(mapping) ? Created.Except(new[] { mapping }).ToArray() : Created; var pending = Pending.Contains(mapping) ? Pending.Except(new[] { mapping }).ToArray() : Pending; var failed = Failed.Contains(mapping) ? Failed.Except(new[] { mapping }).ToArray() : Failed; return(new Mappings(created, pending, failed)); }
public void Create(IActiveRecord record) { if (record == null) { return; } if (Created.Contains(record)) { return; } OnBeforeCreate(new ActiveRecordTransactionEventArgs(record)); _created.Add(record); }