This repository was archived by the owner on Dec 24, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +3
-3
lines changed
src/ServiceStack.OrmLite/Expressions
tests/ServiceStack.OrmLite.VbNetTests Expand file tree Collapse file tree 2 files changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -1053,14 +1053,14 @@ protected virtual object VisitBinary(BinaryExpression b)
1053
1053
if ( right as PartialSqlString == null )
1054
1054
right = ( ( bool ) right ) ? GetTrueExpression ( ) : GetFalseExpression ( ) ;
1055
1055
}
1056
- else if ( operand == "=" && b . Left is MethodCallExpression && ( ( MethodCallExpression ) b . Left ) . Method . Name == "CompareString" )
1056
+ else if ( ( operand == "=" || operand == "<>" ) && b . Left is MethodCallExpression && ( ( MethodCallExpression ) b . Left ) . Method . Name == "CompareString" )
1057
1057
{
1058
1058
//Handle VB.NET converting (x => x.Name == "Foo") into (x => CompareString(x.Name, "Foo", False)
1059
1059
var methodExpr = ( MethodCallExpression ) b . Left ;
1060
1060
var args = this . VisitExpressionList ( methodExpr . Arguments ) ;
1061
1061
object quotedColName = args [ 0 ] ;
1062
1062
object value = GetValue ( args [ 1 ] , typeof ( string ) ) ;
1063
- return new PartialSqlString ( "(" + quotedColName + " = " + value + ")" ) ;
1063
+ return new PartialSqlString ( "({0} {1} {2})" . Fmt ( quotedColName , operand , value ) ) ;
1064
1064
}
1065
1065
else
1066
1066
{
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ Module Module1
28
28
29
29
Dim q As SqlExpression( Of Poco) = db.From( Of Poco)()
30
30
31
- q.Where( Function (x) x.Name = "Foo ")
31
+ q.Where( Function (x) x.Name <> "Bar ")
32
32
33
33
Dim rows As List( Of Poco) = db.Select(q)
34
34
You can’t perform that action at this time.
0 commit comments