zoukankan      html  css  js  c++  java
  • Bitter.Core系列 十二 :Bitter ORM NETCORE ORM 全网最粗暴简单易用高性能的 NETCore 之 支持的 where 条件表达式

    Bitter.Core 内置了支持大部分的 linq 的条件表达式。基本上符合我们 where 条件所需。Bitter.Core 的支持 表达式内置  扩展 有:

    • EndsWith    在Sql 解析成:  ‘%s’
    • StartsWith   在Sql 解析成:  ‘s%’
    • Contains     在Sql 解析成:  ‘%s%’
    • In                在Sql 解析成:     IN (1,2,34)
    • NotIn          在Sql 解析成:   NOT IN  (1,2,34)
    • IsNull          在Sql 解析成:    ISNUL(dbfiled,0)
    • Like             在Sql 解析成:    Like‘%s%’
    • NotLike       在Sql 解析成:   Not Like‘%s%’
    • >=              在Sql 解析成:   >=
    • <=              在Sql 解析成:   <=   
    • >                 在Sql 解析成:   >
    • <                 在Sql 解析成:   <
    • =                 在Sql 解析成:   =
    • !=                在Sql 解析成:   !=
    • &&              在Sql 解析成:  and (….)
    • ||                 在Sql 解析成:  (….) || (…)


    下面附上条件表达式如下demo 所示:


    static void Main(string[] args)
            {
                Console.WriteLine("Hello World!");
    
                MonitorInfo monitor_end = db.FindQuery<TStudentInfo>().Where(p => p.FName.EndsWith("h")).ToMonitorInfo();
    
                MonitorInfo monitor_start = db.FindQuery<TStudentInfo>().Where(p => p.FName.StartsWith("j")).ToMonitorInfo();
    
                MonitorInfo monitor_contains = db.FindQuery<TStudentInfo>().Where(p => p.FName.Contains("h")).ToMonitorInfo();
    
                MonitorInfo monitor_in = db.FindQuery<TStudentInfo>().Where(p => p.FAage.In(new int?[] { 1,2,3,4})).ToMonitorInfo();
    
                MonitorInfo monitor_notin = db.FindQuery<TStudentInfo>().Where(p => p.FAage.NotIn(new int?[] { 1, 2, 3, 4 })).ToMonitorInfo();
    
                MonitorInfo monitor_isnull_str = db.FindQuery<TStudentInfo>().Where(p => p.FName.IsNull("")).ToMonitorInfo();
    
                MonitorInfo monitor_isnull_int = db.FindQuery<TStudentInfo>().Where(p => p.FAage.IsNull(-1)).ToMonitorInfo();
    
                MonitorInfo monitor_like = db.FindQuery<TStudentInfo>().Where(p => p.FName.Like("h")).ToMonitorInfo();
    
                MonitorInfo monitor_Notlike = db.FindQuery<TStudentInfo>().Where(p => p.FName.NotLike("h")).ToMonitorInfo();
    
                MonitorInfo monitor_ThanEquel = db.FindQuery<TStudentInfo>().Where(p => p.FAage>=10).ToMonitorInfo();
    
                MonitorInfo monitor_LessThanEquel = db.FindQuery<TStudentInfo>().Where(p => p.FAage <=10).ToMonitorInfo();
    
                MonitorInfo monitor_And = db.FindQuery<TStudentInfo>().Where(p => p.FAage <= 10 && p.FAage<=20).ToMonitorInfo();
    
                MonitorInfo monitor_And_And = db.FindQuery<TStudentInfo>().Where(p =>p.FName.Like("h")&&(p.FAage <= 10 && p.FAage <= 20)).ToMonitorInfo();
    
                MonitorInfo monitor_And_And_And = db.FindQuery<TStudentInfo>().Where(p => p.FName.Like("h") && (p.FAage <= 10 && p.FAage <= 20)).Where(p=>p.FAddTime>"2020-10-11".ToSafeDateTime()).ToMonitorInfo();
    
                var k= Console.ReadKey();
            }
  • 相关阅读:
    PointToPointNetDevice doesn't support TapBridgeHelper
    NS3系列—10———NS3 NodeContainer
    NS3系列—9———NS3 IP首部校验和
    NS3系列—8———NS3编译运行
    【习题 7-6 UVA
    【Good Bye 2017 C】 New Year and Curling
    【Good Bye 2017 B】 New Year and Buggy Bot
    【Good Bye 2017 A】New Year and Counting Cards
    【Educational Codeforces Round 35 D】Inversion Counting
    【Educational Codeforces Round 35 C】Two Cakes
  • 原文地址:https://www.cnblogs.com/davidchildblog/p/14329100.html
Copyright © 2011-2022 走看看