I'm trying to build method that would delete all entries in specified table that match the condition.
public void DeleteAll(Expression<Func<T, bool>> condition)
{
var service = PluralizationService.CreateService(new CultureInfo("en-US"));
var tableName = service.Pluralize(typeof(T).Name);
Context.Database.ExecuteSqlCommand(string.Format("DELETE FROM {0} WHERE {1}", tableName, condition));
}
Currently this is not working as I'm not able to properly convert condition given as lambda expression to meaningful SQL syntax that would fit after WHERE clause. I can do some things manually but I was wondering if there is a way to do it with means provided with .NET framework.