| SqlExpressionEGetDeleteSql Method |
Namespace: LiteRepository
public string GetDeleteSql( Expression<Func<E, bool>> where = null, Object param = null )
Where expression used like in GetSelectSql. But if you don't pass where expression, method returns SQL with where condition to delete item by key.
Suppose we have a class:
public class User { [SqlKey] public int Id { get; set; } public string FirstName { get; set; } public string SecondName { get; set; } public DateTime Birthday { get; set; } [SqlIgnore] public string FullName { get { return FirstName + " " + SecondName; } } }
Then you call method without parameters:
var sql = GetDeleteSql(); // delete from User where Id=@Id;