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

Commit 1c5857a

Browse files
author
Thomas Grassauer
committed
fixed issue #175
1 parent 2ba049c commit 1c5857a

File tree

4 files changed

+16
-5
lines changed

4 files changed

+16
-5
lines changed

src/ServiceStack.OrmLite.SqlServerTests/SqlServerExpressionVisitorQueryTest.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,14 +107,15 @@ public void test_if_and_works_with_nullable_parameter()
107107
db.CreateTable<TestEntity>(true);
108108
db.Insert(new TestEntity
109109
{
110-
Id = 2000,
111110
Foo = this.RandomString(16),
112111
Bar = this.RandomString(16),
113112
Baz = this.RandomDecimal()
114113
});
115114

115+
var id = (int)db.GetLastInsertId();
116+
116117
var ev = OrmLiteConfig.DialectProvider.ExpressionVisitor<TestEntity>();
117-
ev.Where(e => e.Id == 2000);
118+
ev.Where(e => e.Id == id);
118119
int? i = null;
119120
ev.And(e => e.NullInt == i);
120121

src/ServiceStack.OrmLite/Expressions/SqlExpressionVisitor.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -737,8 +737,8 @@ protected virtual object VisitBinary(BinaryExpression b)
737737

738738
}
739739

740-
if (operand == "=" && right.ToString() == "null") operand = "is";
741-
else if (operand == "<>" && right.ToString() == "null") operand = "is not";
740+
if (operand == "=" && right.ToString().Equals("null", StringComparison.InvariantCultureIgnoreCase)) operand = "is";
741+
else if (operand == "<>" && right.ToString().Equals("null", StringComparison.InvariantCultureIgnoreCase)) operand = "is not";
742742

743743
switch (operand)
744744
{

tests/ServiceStack.OrmLite.Tests/ForeignKeyAttributeTests.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,15 @@ public void Setup()
1111
{
1212
using (var dbConn = ConnectionString.OpenDbConnection())
1313
{
14+
dbConn.DropTable<TypeWithOnDeleteAndUpdateCascade>();
15+
dbConn.DropTable<TypeWithOnDeleteSetNull>();
16+
dbConn.DropTable<TypeWithOnDeleteSetDefault>();
17+
dbConn.DropTable<TypeWithOnDeleteRestrict>();
18+
dbConn.DropTable<TypeWithOnDeleteNoAction>();
19+
dbConn.DropTable<TypeWithOnDeleteCascade>();
20+
dbConn.DropTable<TypeWithSimpleForeignKey>();
21+
dbConn.DropTable<ReferencedType>();
22+
1423
dbConn.DropAndCreateTable<ReferencedType>();
1524
}
1625
}

tests/ServiceStack.OrmLite.Tests/OrmLiteTestBase.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ public class Config
1414
public static string SqliteFileDir = "~/App_Data/".MapAbsolutePath();
1515
public static string SqliteFileDb = "~/App_Data/db.sqlite".MapAbsolutePath();
1616
public static string SqlServerDb = "~/App_Data/Database1.mdf".MapAbsolutePath();
17-
public static string SqlServerBuildDb = "Server=pc;Database=test;User Id=pc;Password=pc;";
17+
//public static string SqlServerBuildDb = "Server=pc;Database=test;User Id=pc;Password=pc;";
18+
public static string SqlServerBuildDb = "Data Source=localhost;Initial Catalog=TestDb;Integrated Security=SSPI;Connect Timeout=120;MultipleActiveResultSets=True";
1819

1920
public static IOrmLiteDialectProvider DefaultProvider = SqlServerDialect.Provider;
2021
public static string DefaultConnection = SqlServerBuildDb;

0 commit comments

Comments
 (0)