Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit 02c0205

Browse files
committed
Add new VB.NET Test project and support for VB.NET's string comparison lambda expressions
1 parent 005cc61 commit 02c0205

17 files changed

+11557
-0
lines changed

src/ServiceStack.OrmLite.sln

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServiceStack.OrmLite.SqlSer
111111
EndProject
112112
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServiceStack.OrmLite.SqliteV45", "ServiceStack.OrmLite.SqliteV45\ServiceStack.OrmLite.SqliteV45.csproj", "{30C0C876-ABCB-441B-BFD4-AA9F688D9E54}"
113113
EndProject
114+
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "ServiceStack.OrmLite.VbNetTests", "..\tests\ServiceStack.OrmLite.VbNetTests\ServiceStack.OrmLite.VbNetTests.vbproj", "{CC385BE2-B49D-46AF-8F1B-BC9943E106E6}"
115+
EndProject
114116
Global
115117
GlobalSection(SolutionConfigurationPlatforms) = preSolution
116118
Debug|Any CPU = Debug|Any CPU
@@ -819,6 +821,26 @@ Global
819821
{30C0C876-ABCB-441B-BFD4-AA9F688D9E54}.Signed|Mixed Platforms.ActiveCfg = Release|Any CPU
820822
{30C0C876-ABCB-441B-BFD4-AA9F688D9E54}.Signed|Mixed Platforms.Build.0 = Release|Any CPU
821823
{30C0C876-ABCB-441B-BFD4-AA9F688D9E54}.Signed|x86.ActiveCfg = Release|Any CPU
824+
{CC385BE2-B49D-46AF-8F1B-BC9943E106E6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
825+
{CC385BE2-B49D-46AF-8F1B-BC9943E106E6}.Debug|Any CPU.Build.0 = Debug|Any CPU
826+
{CC385BE2-B49D-46AF-8F1B-BC9943E106E6}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
827+
{CC385BE2-B49D-46AF-8F1B-BC9943E106E6}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
828+
{CC385BE2-B49D-46AF-8F1B-BC9943E106E6}.Debug|x86.ActiveCfg = Debug|Any CPU
829+
{CC385BE2-B49D-46AF-8F1B-BC9943E106E6}.Default|Any CPU.ActiveCfg = Debug|Any CPU
830+
{CC385BE2-B49D-46AF-8F1B-BC9943E106E6}.Default|Any CPU.Build.0 = Debug|Any CPU
831+
{CC385BE2-B49D-46AF-8F1B-BC9943E106E6}.Default|Mixed Platforms.ActiveCfg = Debug|Any CPU
832+
{CC385BE2-B49D-46AF-8F1B-BC9943E106E6}.Default|Mixed Platforms.Build.0 = Debug|Any CPU
833+
{CC385BE2-B49D-46AF-8F1B-BC9943E106E6}.Default|x86.ActiveCfg = Debug|Any CPU
834+
{CC385BE2-B49D-46AF-8F1B-BC9943E106E6}.Release|Any CPU.ActiveCfg = Release|Any CPU
835+
{CC385BE2-B49D-46AF-8F1B-BC9943E106E6}.Release|Any CPU.Build.0 = Release|Any CPU
836+
{CC385BE2-B49D-46AF-8F1B-BC9943E106E6}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
837+
{CC385BE2-B49D-46AF-8F1B-BC9943E106E6}.Release|Mixed Platforms.Build.0 = Release|Any CPU
838+
{CC385BE2-B49D-46AF-8F1B-BC9943E106E6}.Release|x86.ActiveCfg = Release|Any CPU
839+
{CC385BE2-B49D-46AF-8F1B-BC9943E106E6}.Signed|Any CPU.ActiveCfg = Release|Any CPU
840+
{CC385BE2-B49D-46AF-8F1B-BC9943E106E6}.Signed|Any CPU.Build.0 = Release|Any CPU
841+
{CC385BE2-B49D-46AF-8F1B-BC9943E106E6}.Signed|Mixed Platforms.ActiveCfg = Release|Any CPU
842+
{CC385BE2-B49D-46AF-8F1B-BC9943E106E6}.Signed|Mixed Platforms.Build.0 = Release|Any CPU
843+
{CC385BE2-B49D-46AF-8F1B-BC9943E106E6}.Signed|x86.ActiveCfg = Release|Any CPU
822844
EndGlobalSection
823845
GlobalSection(SolutionProperties) = preSolution
824846
HideSolutionNode = FALSE

src/ServiceStack.OrmLite/Expressions/SqlExpression.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1043,6 +1043,15 @@ protected virtual object VisitBinary(BinaryExpression b)
10431043
if (right as PartialSqlString == null)
10441044
right = ((bool)right) ? GetTrueExpression() : GetFalseExpression();
10451045
}
1046+
else if (operand == "=" && b.Left is MethodCallExpression && ((MethodCallExpression)b.Left).Method.Name == "CompareString")
1047+
{
1048+
//Handle VB.NET converting (x => x.Name == "Foo") into (x => CompareString(x.Name, "Foo", False)
1049+
var methodExpr = (MethodCallExpression)b.Left;
1050+
var args = this.VisitExpressionList(methodExpr.Arguments);
1051+
object quotedColName = args[0];
1052+
object value = GetValue(args[1], typeof(string));
1053+
return new PartialSqlString("(" + quotedColName + " = " + value + ")");
1054+
}
10461055
else
10471056
{
10481057
originalLeft = left = Visit(b.Left);
@@ -1076,7 +1085,9 @@ protected virtual object VisitBinary(BinaryExpression b)
10761085
return result;
10771086
}
10781087
else if (left as PartialSqlString == null)
1088+
{
10791089
left = DialectProvider.GetQuotedValue(left, left != null ? left.GetType() : null);
1090+
}
10801091
else if (right as PartialSqlString == null)
10811092
{
10821093
right = GetValue(right, right != null ? right.GetType() : null);

src/UpgradeLog.htm

26.5 KB
Binary file not shown.
Binary file not shown.

src/packages/NUnit.2.6.4/lib/nunit.framework.xml

Lines changed: 10984 additions & 0 deletions
Large diffs are not rendered by default.

src/packages/NUnit.2.6.4/license.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
Copyright � 2002-2014 Charlie Poole
2+
Copyright � 2002-2004 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
3+
Copyright � 2000-2002 Philip A. Craig
4+
5+
This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.
6+
7+
Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:
8+
9+
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment (see the following) in the product documentation is required.
10+
11+
Portions Copyright � 2002-2014 Charlie Poole or Copyright � 2002-2004 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov or Copyright � 2000-2002 Philip A. Craig
12+
13+
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
14+
15+
3. This notice may not be removed or altered from any source distribution.

src/packages/repositories.config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<repositories>
33
<repository path="..\..\tests\ServiceStack.OrmLite.Sqlite.Windows.Tests\packages.config" />
4+
<repository path="..\..\tests\ServiceStack.OrmLite.VbNetTests\packages.config" />
45
<repository path="..\..\tests\ServiceStack.OrmLiteV45.Tests\packages.config" />
56
<repository path="..\FirebirdTests\TestSimpleFirebird02\packages.config" />
67
<repository path="..\ServiceStack.OrmLite.DDLTest\packages.config" />
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
Imports System
2+
Imports ServiceStack
3+
Imports ServiceStack.Text
4+
Imports ServiceStack.OrmLite
5+
6+
Module Module1
7+
8+
Public Class Poco
9+
Public Property Id As Integer
10+
Public Property Name As String
11+
End Class
12+
13+
Sub Main()
14+
Console.Write("Hello VB.NET ")
15+
Console.Write(Env.VersionString)
16+
17+
Dim dbFactory As New OrmLiteConnectionFactory(":memory:", SqliteDialect.Provider)
18+
19+
Dim db As IDbConnection = dbFactory.Open()
20+
21+
db.DropAndCreateTable(Of Poco)()
22+
23+
Dim row As New Poco()
24+
row.Id = 1
25+
row.Name = "Foo"
26+
27+
db.Insert(row)
28+
29+
Dim q As SqlExpression(Of Poco) = db.From(Of Poco)()
30+
31+
q.Where(Function(x) x.Name = "Foo")
32+
33+
Dim rows As List(Of Poco) = db.Select(q)
34+
35+
rows.PrintDump()
36+
37+
Console.ReadLine()
38+
End Sub
39+
40+
End Module

tests/ServiceStack.OrmLite.VbNetTests/My Project/Application.Designer.vb

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<MyApplicationData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
3+
<MySubMain>false</MySubMain>
4+
<SingleInstance>false</SingleInstance>
5+
<ShutdownMode>0</ShutdownMode>
6+
<EnableVisualStyles>true</EnableVisualStyles>
7+
<AuthenticationMode>0</AuthenticationMode>
8+
<ApplicationType>1</ApplicationType>
9+
<SaveMySettingsOnExit>true</SaveMySettingsOnExit>
10+
</MyApplicationData>

0 commit comments

Comments
 (0)