private static void SetupDelete(IMapping <T> Mapping, IEnumerable <IMapping> ParentMappings) { Contract.Requires <ArgumentNullException>(Mapping != null, "Mapping"); if (!string.IsNullOrEmpty(Mapping.DeleteCommand)) { return; } string IDProperties = ""; int Count = 0; string Separator = ""; foreach (IProperty Property in Mapping.IDProperties) { IDProperties += Separator + Property.FieldName + "=@" + Count; Separator = " AND "; ++Count; } Mapping.SetDeleteCommand(string.Format(CultureInfo.InvariantCulture, "DELETE FROM {0} WHERE {1}", Mapping.TableName, IDProperties), CommandType.Text); }