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/Expressions
tests/ServiceStack.OrmLite.Tests/Expression Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -2660,6 +2660,9 @@ protected virtual object VisitColumnAccessMethod(MethodCallExpression m)
26602660 case "ToLower" :
26612661 statement = $ "lower({ quotedColName } )";
26622662 break ;
2663+ case "Equals" :
2664+ statement = $ "{ quotedColName } ={ ConvertToParam ( wildcardArg ) } ";
2665+ break ;
26632666 case "StartsWith" :
26642667 statement = ! OrmLiteConfig . StripUpperInLike
26652668 ? $ "upper({ quotedColName } ) like { ConvertToParam ( wildcardArg . ToUpper ( ) + "%" ) } { escapeSuffix } "
Original file line number Diff line number Diff line change @@ -196,6 +196,30 @@ public void Can_select_using_startsWith_with_backtick_in_string()
196196 }
197197 }
198198
199+ [ Test ]
200+ public void Can_select_using_Equals ( )
201+ {
202+ var postfix = "postfix" ;
203+
204+ var expected = new TestType ( )
205+ {
206+ IntColumn = 7 ,
207+ BoolColumn = true ,
208+ StringColumn = postfix
209+ } ;
210+
211+ Init ( 10 , expected ) ;
212+
213+ using ( var db = OpenDbConnection ( ) )
214+ {
215+ var actual = db . Select < TestType > ( q => q . StringColumn . Equals ( postfix ) ) ;
216+
217+ Assert . IsNotNull ( actual ) ;
218+ Assert . AreEqual ( 1 , actual . Count ) ;
219+ CollectionAssert . Contains ( actual , expected ) ;
220+ }
221+ }
222+
199223 [ Test ]
200224 public void Can_select_using_endsWith ( )
201225 {
You can’t perform that action at this time.
0 commit comments