public virtual bool Remove(ISpecification <TEntity> specification) { if (this.OnRemove != null) { OnRemove(ref specification); } DBBuilder condition; if (specification.Lambda != null) { var ids = this.Entities.Where(specification.Lambda).Select(d => d.ID).ToList(); if (ids.Count > 0) { condition = DBBuilder.Define().Field(_entityDefinition.Value.TableAttribute.TableName, "ID").In(builder => builder.Value(ids.ToArray())); } else { condition = new FalseSpec <TEntity>().Sql; } } else { condition = specification.Sql; } var dbBuilder = condition.IsCommand ? condition : DBBuilder.Delete(_entityDefinition.Value.TableAttribute.TableName).Where(condition); var result = this.UnitOfWork.Execute(dbBuilder); return(result > 0); }