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 +27
-0
lines changed
src/ServiceStack.OrmLite.SqlServerTests Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -98,6 +98,31 @@ public void test_if_ev_still_works_without_limit_and_orderby()
98
98
Assert . IsTrue ( result . Count > 0 ) ;
99
99
}
100
100
}
101
+
102
+ [ Test ]
103
+ public void test_if_and_works_with_nullable_parameter ( )
104
+ {
105
+ using ( var db = ConnectionString . OpenDbConnection ( ) )
106
+ {
107
+ db . CreateTable < TestEntity > ( true ) ;
108
+ db . Insert ( new TestEntity
109
+ {
110
+ Id = 2000 ,
111
+ Foo = this . RandomString ( 16 ) ,
112
+ Bar = this . RandomString ( 16 ) ,
113
+ Baz = this . RandomDecimal ( )
114
+ } ) ;
115
+
116
+ var ev = OrmLiteConfig . DialectProvider . ExpressionVisitor < TestEntity > ( ) ;
117
+ ev . Where ( e => e . Id == 2000 ) ;
118
+ int ? i = null ;
119
+ ev . And ( e => e . NullInt == i ) ;
120
+
121
+ var result = db . Select ( ev ) ;
122
+ Assert . NotNull ( result ) ;
123
+ Assert . IsTrue ( result . Count > 0 ) ;
124
+ }
125
+ }
101
126
102
127
protected void FillTestEntityTableWithTestData ( IDbConnection db )
103
128
{
Original file line number Diff line number Diff line change @@ -15,6 +15,8 @@ public class TestEntity
15
15
16
16
public String Foo { get ; set ; }
17
17
public String Bar { get ; set ; }
18
+ public int ? NullInt { get ; set ; }
19
+
18
20
[ Index ]
19
21
public Decimal Baz { get ; set ; }
20
22
You can’t perform that action at this time.
0 commit comments