mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-04-22 10:42:52 +08:00
- 修复 preview0808 表达式解析 null 异常
This commit is contained in:
parent
e49f8b56fc
commit
4bf81111f0
@ -4,6 +4,17 @@ Imports Xunit
|
||||
|
||||
Namespace FreeSql.Tests.VB
|
||||
Public Class UnitTest1
|
||||
|
||||
<Fact>
|
||||
Sub IsNothing()
|
||||
Dim sql = g.sqlserver.Select(Of Testvb).Where(Function(a) a.Id = 100 AndAlso a.Title Is Nothing).ToSql()
|
||||
Assert.Equal("SELECT a.[Id], a.[Title], a.[IsDeleted], a.[IdNullable]
|
||||
FROM [Testvb] a
|
||||
WHERE (a.[Id] = 100 AND a.[Title] IS NULL)", sql)
|
||||
|
||||
Dim lst = g.sqlserver.Select(Of Testvb).Where(Function(a) a.Id = 100 AndAlso a.Title Is Nothing).ToList()
|
||||
End Sub
|
||||
|
||||
<Fact>
|
||||
Sub TestSub()
|
||||
|
||||
|
@ -499,9 +499,9 @@ namespace FreeSql.Internal
|
||||
case "=":
|
||||
case "<>":
|
||||
var exptb = _common.GetTableByEntity(leftExp.Type);
|
||||
if (exptb != null) leftExp = Expression.MakeMemberAccess(leftExp, exptb.Properties[(exptb.Primarys.FirstOrDefault() ?? exptb.Columns.FirstOrDefault().Value).CsName]);
|
||||
if (exptb?.Properties.Any() == true) leftExp = Expression.MakeMemberAccess(leftExp, exptb.Properties[(exptb.Primarys.FirstOrDefault() ?? exptb.Columns.FirstOrDefault().Value)?.CsName]);
|
||||
exptb = _common.GetTableByEntity(leftExp.Type);
|
||||
if (exptb?.Primarys.Any() == true) rightExp = Expression.MakeMemberAccess(rightExp, exptb.Properties[(exptb.Primarys.FirstOrDefault() ?? exptb.Columns.FirstOrDefault().Value).CsName]);
|
||||
if (exptb?.Properties.Any() == true) rightExp = Expression.MakeMemberAccess(rightExp, exptb.Properties[(exptb.Primarys.FirstOrDefault() ?? exptb.Columns.FirstOrDefault().Value).CsName]);
|
||||
break;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user