本文整理汇总了C#中ExpressionBuilder.Build方法的典型用法代码示例。如果您正苦于以下问题:C# ExpressionBuilder.Build方法的具体用法?C# ExpressionBuilder.Build怎么用?C# ExpressionBuilder.Build使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ExpressionBuilder
的用法示例。
在下文中一共展示了ExpressionBuilder.Build方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: StringContainsString
public void StringContainsString()
{
var builder = new ExpressionBuilder<User>();
var condition = builder.BuildContains("Password", "123");
var where = builder.Build(condition);
var results = db.Set<User>().Where(where).ToList();
Console.WriteLine(results.Count + "条数据");
}
示例2: ListContainsColumn
public void ListContainsColumn()
{
var builder = new ExpressionBuilder<User>();
var condition = builder.BuildContains("Id", new int[] { 9, 10 });
var where = builder.Build(condition);
var results = db.Set<User>().Where(where).ToList();
Console.WriteLine(results.Count + "条数据");
}
示例3: BuildFilters
public void BuildFilters()
{
var builder = new ExpressionBuilder<User>();
var filters = new List<SqlFilter>();
filters.Add(SqlFilter.Create("Id", Operation.Equal, 1));
filters.Add(SqlFilter.Create("LastLoginDate", Operation.GreaterThan, DateTime.Now));
filters.Add(SqlFilter.Create("Username", Operation.Like, "aaaa"));
filters.Add(SqlFilter.Create("Id", Operation.List, new int[] { 1, 2, 3 }));
filters.Add(SqlFilter.Create("Password", Operation.NotEqual, "1"));
filters.Add(SqlFilter.Create("Status", Operation.List, new int[] { 1 }));
var where = builder.Build(filters, new Dictionary<string, string>());
var results = db.Set<User>().Where(where).ToList();
Console.WriteLine(results.Count + "条数据");
}