Skip to content

Commit e011a34

Browse files
committed
Initial changes to support CoreCLR
1 parent 0a85020 commit e011a34

File tree

165 files changed

+14596
-8663
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

165 files changed

+14596
-8663
lines changed

.gitignore

+5-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,8 @@ obj
66
*.user
77
_ReSharper*
88
src/TestResults
9-
packages
9+
packages
10+
artifacts
11+
TestResult.xml
12+
UnitTests*
13+
.vs*

NPoco.sln

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 14
4+
VisualStudioVersion = 14.0.23107.0
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{C7A94BA4-5689-4651-872D-7D7711D2DEDF}"
7+
EndProject
8+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{5DECCA80-ED5E-41E9-9B84-5F55E8666AC0}"
9+
ProjectSection(SolutionItems) = preProject
10+
global.json = global.json
11+
NuGet.Config = NuGet.Config
12+
EndProjectSection
13+
EndProject
14+
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "NPoco", "src\NPoco\NPoco.xproj", "{56481BBA-35A1-4061-9FE8-0ED9E1B6A0A3}"
15+
EndProject
16+
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "NPoco.Tests", "src\NPoco.Tests\NPoco.Tests.xproj", "{B39C2641-0655-47CC-A1A3-5E1F84714FB5}"
17+
EndProject
18+
Global
19+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
20+
Debug|Any CPU = Debug|Any CPU
21+
Release|Any CPU = Release|Any CPU
22+
EndGlobalSection
23+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
24+
{56481BBA-35A1-4061-9FE8-0ED9E1B6A0A3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
25+
{56481BBA-35A1-4061-9FE8-0ED9E1B6A0A3}.Debug|Any CPU.Build.0 = Debug|Any CPU
26+
{56481BBA-35A1-4061-9FE8-0ED9E1B6A0A3}.Release|Any CPU.ActiveCfg = Release|Any CPU
27+
{56481BBA-35A1-4061-9FE8-0ED9E1B6A0A3}.Release|Any CPU.Build.0 = Release|Any CPU
28+
{B39C2641-0655-47CC-A1A3-5E1F84714FB5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
29+
{B39C2641-0655-47CC-A1A3-5E1F84714FB5}.Debug|Any CPU.Build.0 = Debug|Any CPU
30+
{B39C2641-0655-47CC-A1A3-5E1F84714FB5}.Release|Any CPU.ActiveCfg = Release|Any CPU
31+
{B39C2641-0655-47CC-A1A3-5E1F84714FB5}.Release|Any CPU.Build.0 = Release|Any CPU
32+
EndGlobalSection
33+
GlobalSection(SolutionProperties) = preSolution
34+
HideSolutionNode = FALSE
35+
EndGlobalSection
36+
GlobalSection(NestedProjects) = preSolution
37+
{56481BBA-35A1-4061-9FE8-0ED9E1B6A0A3} = {C7A94BA4-5689-4651-872D-7D7711D2DEDF}
38+
{B39C2641-0655-47CC-A1A3-5E1F84714FB5} = {C7A94BA4-5689-4651-872D-7D7711D2DEDF}
39+
EndGlobalSection
40+
EndGlobal

NuGet.Config

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<configuration>
3+
<packageSources>
4+
<add key="api.nuget.org" value="https://api.nuget.org/v3/index.json" />
5+
</packageSources>
6+
</configuration>

build.ps1

+9-21
Original file line numberDiff line numberDiff line change
@@ -6,30 +6,20 @@
66
#
77
Properties {
88
$build_dir = Split-Path $psake.build_script_file
9-
$build_artifacts_dir = "$build_dir\build\"
10-
$solution_file = "$build_dir\src\NPoco\NPoco.csproj"
9+
$build_artifacts_dir = "$build_dir\build"
10+
$solution_dir = "$build_dir\src\NPoco"
1111
}
1212

1313
FormatTaskName (("-"*25) + "[{0}]" + ("-"*25))
1414

15-
Task Default -Depends Build35
15+
Task Default -depends Build
1616

17-
Task Build35 -Depends Build40 {
18-
Write-Host "Building 3.5 $solution_file" -ForegroundColor Green
19-
Exec { msbuild "$solution_file" /t:Clean /p:Configuration=Release /v:quiet }
20-
Exec { msbuild "$solution_file" /t:Build /p:Configuration=Release /v:quiet /p:TargetFrameworkVersion=v3.5 /p:OutDir="$build_artifacts_dir\net35\" /p:DefineConstants="NET35"}
21-
}
22-
23-
Task Build40 -Depends Build45 {
24-
Write-Host "Building 4.0 $solution_file" -ForegroundColor Green
25-
Exec { msbuild "$solution_file" /t:Clean /p:Configuration=Release /v:quiet }
26-
Exec { msbuild "$solution_file" /t:Build /p:Configuration=Release /v:quiet /p:TargetFrameworkVersion=v4.0 /p:OutDir="$build_artifacts_dir\net40\" /p:DefineConstants="NET40" }
27-
}
28-
29-
Task Build45 -Depends Clean {
30-
Write-Host "Building 4.5 $solution_file" -ForegroundColor Green
31-
Exec { msbuild "$solution_file" /t:Clean /p:Configuration=Release /v:quiet }
32-
Exec { msbuild "$solution_file" /t:Build /p:Configuration=Release /v:quiet /p:TargetFrameworkVersion=v4.5 /p:OutDir="$build_artifacts_dir\net45\" /p:DefineConstants="NET45" }
17+
Task Build -depends Clean {
18+
Write-Host "Creating BuildArtifacts" -ForegroundColor Green
19+
Set-Location "$solution_dir"
20+
Exec {
21+
dnu pack --configuration release --out $build_artifacts_dir --quiet
22+
}
3323
}
3424

3525
Task Clean {
@@ -40,6 +30,4 @@ Task Clean {
4030
}
4131

4232
mkdir $build_artifacts_dir | out-null
43-
44-
Write-Host "Cleaning $solution_file" -ForegroundColor Green
4533
}

global.json

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"projects": [
3+
"src",
4+
"test",
5+
"wrap"
6+
],
7+
"sdk": {
8+
"version": "1.0.0-rc1-final"
9+
}
10+
}
-686 KB
Binary file not shown.

lib/nunit.framework.dll

-132 KB
Binary file not shown.

src/NPoco.Tests/App.config

-43
This file was deleted.

src/NPoco.Tests/Async/InsertAsyncTests.cs

-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Text;
5-
using System.Threading;
62
using System.Threading.Tasks;
73
using NPoco.Tests.Common;
84
using NUnit.Framework;

src/NPoco.Tests/Async/QueryAsyncTests.cs

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Text;
5-
using System.Threading.Tasks;
1+
using System.Threading.Tasks;
62
using NPoco.Tests.Common;
73
using NUnit.Framework;
84

src/NPoco.Tests/Async/UpdateAsyncTests.cs

-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Text;
52
using System.Threading.Tasks;
63
using NPoco.Tests.Common;
74
using NUnit.Framework;

src/NPoco.Tests/Common/AdHocUser.cs

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Text;
5-
6-
namespace NPoco.Tests.Common
1+
namespace NPoco.Tests.Common
72
{
83
public class AdHocUser
94
{

src/NPoco.Tests/Common/AssignedPkObjectDecorated.cs

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using NPoco;
23

34
namespace NPoco.Tests.Common
45
{

src/NPoco.Tests/Common/BaseDBDecoratedTest.cs

+15-6
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
using System;
22
using System.Collections.Generic;
3-
using System.Configuration;
43
using System.Data;
4+
using System.Data.SqlClient;
5+
using Microsoft.Framework.Configuration.Json;
6+
#if !DNXCORE50
7+
using FirebirdSql.Data.FirebirdClient;
8+
#endif
9+
using NPoco;
510
using NPoco.DatabaseTypes;
6-
using NPoco.Tests.NewMapper;
711
using NPoco.Tests.NewMapper.Models;
812
using NUnit.Framework;
913

@@ -20,7 +24,11 @@ public class BaseDBDecoratedTest : BaseDBTest
2024
[TestFixtureSetUp]
2125
public void SetUp()
2226
{
23-
var testDBType = Convert.ToInt32(ConfigurationManager.AppSettings["TestDBType"]);
27+
var configuration = new Microsoft.Framework.Configuration.ConfigurationBuilder()
28+
.Add(new JsonConfigurationProvider("config.json"))
29+
.Build();
30+
31+
var testDBType = Convert.ToInt32(configuration.GetSection("TestDBType").Value);
2432
switch (testDBType)
2533
{
2634
case 1: // SQLite In-Memory
@@ -30,7 +38,7 @@ public void SetUp()
3038

3139
case 2: // SQL Local DB
3240
TestDatabase = new SQLLocalDatabase();
33-
Database = new Database(TestDatabase.Connection, new SqlServer2008DatabaseType() { UseOutputClause = false }, IsolationLevel.ReadUncommitted); // Need read uncommitted for the transaction tests
41+
Database = new Database(TestDatabase.Connection, new SqlServer2008DatabaseType() { UseOutputClause = false }, SqlClientFactory.Instance, IsolationLevel.ReadUncommitted); // Need read uncommitted for the transaction tests
3442
break;
3543

3644
case 3: // SQL Server
@@ -40,11 +48,12 @@ public void SetUp()
4048
case 7: // Postgres
4149
Assert.Fail("Database platform not supported for unit testing");
4250
return;
43-
51+
#if !DNXCORE50
4452
case 8: // Firebird
4553
TestDatabase = new FirebirdDatabase();
46-
Database = new Database(TestDatabase.Connection, new FirebirdDatabaseType(), IsolationLevel.ReadUncommitted);
54+
Database = new Database(TestDatabase.Connection, new FirebirdDatabaseType(), FirebirdClientFactory.Instance, IsolationLevel.ReadUncommitted);
4755
break;
56+
#endif
4857

4958
default:
5059
Assert.Fail("Unknown database platform specified");

src/NPoco.Tests/Common/BaseDBFuentTest.cs

+18-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
using System;
22
using System.Collections.Generic;
3-
using System.Configuration;
3+
using System.Data.SqlClient;
44
using System.Linq;
5+
using System.Reflection;
6+
using Microsoft.Framework.Configuration.Json;
7+
using NPoco;
8+
#if !DNXCORE50
9+
using FirebirdSql.Data.FirebirdClient;
10+
#endif
511
using NPoco.DatabaseTypes;
612
using NPoco.FluentMappings;
713
using NPoco.Tests.FluentMappings;
@@ -29,7 +35,7 @@ public void SetUp()
2935
dbFactory.Config().WithFluentConfig(
3036
FluentMappingConfiguration.Scan(s =>
3137
{
32-
s.Assembly(typeof (User).Assembly);
38+
s.Assembly(typeof (User).GetTypeInfo().Assembly);
3339
s.IncludeTypes(types.Contains);
3440
s.PrimaryKeysNamed(y => ToLowerIf(y.Name + "Id", false));
3541
s.TablesNamed(y => ToLowerIf(Inflector.MakePlural(y.Name), false));
@@ -39,8 +45,12 @@ public void SetUp()
3945
s.OverrideMappingsWith(new FluentMappingOverrides());
4046
})
4147
);
42-
43-
var testDBType = Convert.ToInt32(ConfigurationManager.AppSettings["TestDBType"]);
48+
49+
var configuration = new Microsoft.Framework.Configuration.ConfigurationBuilder()
50+
.Add(new JsonConfigurationProvider("config.json"))
51+
.Build();
52+
53+
var testDBType = Convert.ToInt32(configuration.GetSection("TestDBType").Value);
4454
switch (testDBType)
4555
{
4656
case 1: // SQLite In-Memory
@@ -51,7 +61,7 @@ public void SetUp()
5161
case 2: // SQL Local DB
5262
case 3: // SQL Server
5363
TestDatabase = new SQLLocalDatabase();
54-
Database = dbFactory.Build(new Database(TestDatabase.Connection, new SqlServer2008DatabaseType() { UseOutputClause = true }));
64+
Database = dbFactory.Build(new Database(TestDatabase.Connection, new SqlServer2008DatabaseType(), SqlClientFactory.Instance));
5565
break;
5666

5767
case 4: // SQL CE
@@ -60,12 +70,14 @@ public void SetUp()
6070
case 7: // Postgres
6171
Assert.Fail("Database platform not supported for unit testing");
6272
return;
73+
#if !DNXCORE50
6374
case 8: // Firebird
6475
TestDatabase = new FirebirdDatabase();
65-
var db = new Database(TestDatabase.Connection, new FirebirdDatabaseType());
76+
var db = new Database(TestDatabase.Connection, new FirebirdDatabaseType(), FirebirdClientFactory.Instance);
6677
db.Mappers.Insert(0, new FirebirdDefaultMapper());
6778
Database = dbFactory.Build(db);
6879
break;
80+
#endif
6981

7082
default:
7183
Assert.Fail("Unknown database platform specified");

src/NPoco.Tests/Common/BaseDBTest.cs

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1+
using NPoco;
2+
13
namespace NPoco.Tests.Common
24
{
5+
[TestDescriptor]
36
public class BaseDBTest
47
{
58
public IDatabase Database { get; set; }

src/NPoco.Tests/Common/ColumnInfoTests.cs

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Text;
1+
using System.Reflection;
2+
using NPoco;
53
using NUnit.Framework;
64

75
namespace NPoco.Tests.Common

src/NPoco.Tests/Common/CompositeObjectDecorated.cs

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using NPoco;
23

34
namespace NPoco.Tests.Common
45
{

src/NPoco.Tests/Common/CustomerUser.cs

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Text;
1+
using NPoco;
52

63
namespace NPoco.Tests.Common
74
{

src/NPoco.Tests/Common/ExtraUserInfoDecorated.cs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
namespace NPoco.Tests.Common
1+
using NPoco;
2+
3+
namespace NPoco.Tests.Common
24
{
35
[TableName("ExtraUserInfos")]
46
[PrimaryKey("ExtraUserInfoId")]

src/NPoco.Tests/Common/FirebirdDatabase.cs

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
using System;
1+
#if !DNXCORE50
2+
using System;
23
using System.Data;
34
using System.IO;
45
using System.Threading;
56
using FirebirdSql.Data.FirebirdClient;
67
using FirebirdSql.Data.Isql;
78
using FirebirdSql.Data.Services;
9+
using NPoco;
810

911
namespace NPoco.Tests.Common
1012
{
@@ -255,3 +257,4 @@ public override void CleanupDataBase()
255257
}
256258
}
257259
}
260+
#endif

0 commit comments

Comments
 (0)