public virtual StorageAction Delete(IEnumerable <string> tags, IEnumerable <Criteria> criterias = null) { if (Options.EnableLogging) { Log.Debug($"{TableName} delete: tags={tags?.Join("||")}"); } if (tags.IsNullOrEmpty()) { return(StorageAction.None); } using (var conn = CreateConnection()) { var sql = new StringBuilder($"{SqlBuilder.BuildUseDatabase(Options.DatabaseName)} {SqlBuilder.BuildDeleteByTags(TableName)}"); foreach (var t in tags.NullToEmpty()) { sql.Append(SqlBuilder.BuildTagSelect(t)); } foreach (var c in criterias.NullToEmpty()) { sql.Append(SqlBuilder.BuildCriteriaSelect(IndexMaps, c)); } //var sql = SqlBuilder.BuildDeleteByTags(TableName); //tags.NullToEmpty().ForEach(t => sql += SqlBuilder.BuildTagSelect(t)); //criterias.NullToEmpty().ForEach(c => sql += SqlBuilder.BuildCriteriaSelect(IndexMaps, c)); conn.Open(); var num = conn.Execute(sql.ToString()); return(num > 0 ? StorageAction.Deleted : StorageAction.None); } }