1
我可以在運行時在ormlite中構建自定義查詢嗎? 例如我可以在運行時在Ormlite中構建自定義查詢嗎?
public class SearchCriteria
{
public string FieldName { get; set; }
public MatchType MatchType { get; set; }
public object value1 { get; set; }
public object value2 { get; set; }
}
public enum MatchType { StartsWith, Contains, Between, GreaterThan } // ... etc.
public class OrderCriteria
{
public string FieldName { get; set; }
public OrderDirection OrderDirection { get; set; }
}
public enum OrderDirection { Ascending, Descending }
,然後我會打電話與
SearchCriteria[] sCrit = new SearchCriteria[2];
sCriteria[0] = new SearchCriteria{ FieldName = "Description", MatchType = MatchType.Contains, value1 = "vip" }
sCriteria[1] = new SearchCriteria{ FieldName = "Description", MatchType = MatchType.Contains, value1 = "client" }
OrderCriteria[] oCrit = new OrderCriteria[] { new OrderCriteria{ FieldName = "Description", OrderDirection = OrderDirection.Ascending} };
repo.GetItemsList(sCriteria, oCrit);
庫,並留下實際LINQ創作是庫的責任。
如果可能,這會影響ormlite的性能嗎?