2
有特定於域的類:如何從表達式Predicate中獲取Not expression謂詞?
public class Account : IEntity
{
public bool IsActive { get; set; }
public DateTime ExpirationDate { get; set; }
}
有的謂詞從數據源獲取帳戶:
Expression<Func<Account, bool>> predicate = a => a.IsActive == false && a.ExpirationDate < DateTime.Now;
List<Account> lst = new List<Account>();
lst.AsQueryable().Where(predicate);
如何從我的謂語not_predicate產生?其中not_predicate是:
!(a.IsActive == false && a.ExpirationDate < DateTime.Now)