Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port to .NET Standard 2.0 #36

Open
wants to merge 21 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
d679309
Switch from SQL Server Express to SQL Server LocalDB
ggeurts Sep 5, 2018
dbf8919
Assert.DoesNotThrow is not forward compatible with XUnit 2
ggeurts Sep 5, 2018
0b5e080
Prevent Boo compilation errors when output file already exists and ca…
ggeurts Sep 6, 2018
5168c6c
Fix Boo Dsl tests
ggeurts Sep 6, 2018
850aba0
Port projects to Common Project System and use NuGet for external dep…
ggeurts Sep 6, 2018
ef82a13
Fix XUnit 2 parallel test issues
ggeurts Sep 6, 2018
17b7fc5
Consistent namespace declarations
ggeurts Sep 6, 2018
3b0d2c6
Ignore .vs directories
ggeurts Sep 6, 2018
5578cf8
Added connection provider abstraction in preparation for .NET Core su…
ggeurts Sep 12, 2018
9c0a187
Dry common build properties
ggeurts Sep 13, 2018
b77580d
SqlCommandSet not present in .NET Core
ggeurts Sep 13, 2018
e4a6d31
Boo not available in .NET Core
ggeurts Sep 13, 2018
b1a89e1
Work around Westwind DbProviderFactory bug
ggeurts Sep 13, 2018
70bc53a
Add .NET Standard 2.0 platform target. Tests ported to .NET Core 2 an…
ggeurts Sep 13, 2018
d010e88
Ensure transaction disposal before disposal of associated connection …
ggeurts Sep 13, 2018
5a3d42a
Dispose etl processes
ggeurts Sep 13, 2018
cbf0aa2
Don't throw exceptions in threadpool threads, it kills unit testing …
ggeurts Sep 17, 2018
8a88ee2
Create and destroy tests databases on demand
ggeurts Sep 17, 2018
f753c2a
Re-enable large join test
ggeurts Sep 17, 2018
0ddeb02
Fix alternative SqlCommandSet implementation
ggeurts Jul 4, 2019
cffaaf9
.NET Core SqlCommandSet implementation is now usable
ggeurts Jul 4, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ Rhino.Etl.nuspec
*.nupkg
/Rhino-Etl-Cmd.nuspec
Tools/xUnit/Aggregate.*
Tools/xUnit/users.txt
Tools/xUnit/users.txt
.vs/
19 changes: 19 additions & 0 deletions Directory.Build.Props
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8" ?>
<Project>
<PropertyGroup Condition="'$(TargetFramework)' == 'net451'">
<FeatureDsl>True</FeatureDsl>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)' == 'net471'">
<FeatureDsl>True</FeatureDsl>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)' == 'netstandard2.0' OR '$(TargetFramework)' == 'netcoreapp2.0'">
<FeatureWestwind>True</FeatureWestwind>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)' == 'netcoreapp2.1'">
<FeatureWestwind>True</FeatureWestwind>
</PropertyGroup>
<PropertyGroup>
<DefineConstants Condition="'$(FeatureDsl)' == 'True'">FEATURE_DSL;$(DefineConstants)</DefineConstants>
<DefineConstants Condition="'$(FeatureWestwind)' == 'True'">FEATURE_WESTWIND;$(DefineConstants)</DefineConstants>
</PropertyGroup>
</Project>
147 changes: 7 additions & 140 deletions Rhino.Etl.Cmd/Rhino.Etl.Cmd.csproj
Original file line number Diff line number Diff line change
@@ -1,73 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{AAD5286D-943E-472A-A861-8C6F155C8712}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Rhino.Etl.Cmd</RootNamespace>
<AssemblyName>Rhino.Etl.Cmd</AssemblyName>
<FileUpgradeFlags>
</FileUpgradeFlags>
<OldToolsVersion>3.5</OldToolsVersion>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<IsWebBootstrapper>false</IsWebBootstrapper>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<NoWarn>1607</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<TargetFrameworks>net451</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<Reference Include="Boo.Lang">
<HintPath>..\SharedLibs\Boo\Boo.Lang.dll</HintPath>
</Reference>
<Reference Include="Boo.Lang.Compiler">
<HintPath>..\SharedLibs\Boo\Boo.Lang.Compiler.dll</HintPath>
</Reference>
<Reference Include="Boo.Lang.Useful">
<HintPath>..\SharedLibs\Boo\Boo.Lang.Useful.dll</HintPath>
</Reference>
<Reference Include="Common.Logging, Version=2.0.0.0, Culture=neutral, PublicKeyToken=af08829b84f0328e, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\SharedLibs\Common.Logging\Common.Logging.dll</HintPath>
</Reference>
<Reference Include="Common.Logging.Core">
<HintPath>..\SharedLibs\Common.Logging\Common.Logging.Core.dll</HintPath>
</Reference>
<PackageReference Include="Boo.Lang.Useful" Version="0.9.4" />
</ItemGroup>
<ItemGroup>
<Reference Include="Common.Logging.Log4Net1210">
<HintPath>..\SharedLibs\Common.Logging\Common.Logging.Log4Net1210.dll</HintPath>
</Reference>
Expand All @@ -76,81 +15,9 @@
<HintPath>..\SharedLibs\log4net.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Rhino.DSL">
<HintPath>..\SharedLibs\Rhino.Dsl\Rhino.DSL.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="RhinoEtlRunner.cs" />
<Compile Include="RhinoEtlSetup.cs" />
<Compile Include="RhinoEtlCommandLineOptions.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Rhino.Etl.Core\Rhino.Etl.Core.csproj">
<Project>{DC42946E-5972-411C-A061-F2932E49C31F}</Project>
<Name>Rhino.Etl.Core</Name>
<Private>True</Private>
</ProjectReference>
<ProjectReference Include="..\Rhino.Etl.Dsl\Rhino.Etl.Dsl.csproj">
<Project>{D087E051-C099-468D-A3E7-4567DBBDFE69}</Project>
<Name>Rhino.Etl.Dsl</Name>
<Private>True</Private>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="verbose.log4net.config" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="standard.log4net.config" />
</ItemGroup>
<ItemGroup>
<Service Include="{B4F97281-0DBD-4835-9ED8-7DFB966E87FF}" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.2.0">
<Visible>False</Visible>
<ProductName>.NET Framework 2.0 %28x86%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.0">
<Visible>False</Visible>
<ProductName>.NET Framework 3.0 %28x86%29</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<Folder Include="Properties\" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<ProjectReference Include="..\Rhino.Etl.Core\Rhino.Etl.Core.csproj" />
<ProjectReference Include="..\Rhino.Etl.Dsl\Rhino.Etl.Dsl.csproj" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
3 changes: 0 additions & 3 deletions Rhino.Etl.Cmd/app.config

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using System.Configuration;

namespace Rhino.Etl.Core.ConventionOperations
{
using System.Configuration;
using System.Data;
using Operations;
using Rhino.Etl.Core.Infrastructure;
using Rhino.Etl.Core.Operations;

/// <summary>
/// A convention based version of <see cref="InputCommandOperation"/>. Will
Expand Down Expand Up @@ -36,7 +36,8 @@ public int Timeout
/// Initializes a new instance of the <see cref="ConventionInputCommandOperation"/> class.
/// </summary>
/// <param name="connectionStringName">Name of the connection string.</param>
public ConventionInputCommandOperation(string connectionStringName) : this(ConfigurationManager.ConnectionStrings[connectionStringName])
public ConventionInputCommandOperation(string connectionStringName)
: this(Use.ConnectionString(connectionStringName))
{
Timeout = 30;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
using System.Configuration;

namespace Rhino.Etl.Core.ConventionOperations
{
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using Operations;
using Rhino.Etl.Core.Infrastructure;
using Rhino.Etl.Core.Operations;

/// <summary>
/// A convention based version of <see cref="OutputCommandOperation"/>. Will
Expand All @@ -21,7 +19,7 @@ public class ConventionOutputCommandOperation : OutputCommandOperation
/// </summary>
/// <param name="connectionStringName">Name of the connection string.</param>
public ConventionOutputCommandOperation(string connectionStringName)
: this(ConfigurationManager.ConnectionStrings[connectionStringName])
: this(Use.ConnectionString(connectionStringName))
{
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ protected override void PrepareCommand(Row row, SqlCommand sqlCommand)
CopyRowValuesToCommandParameters(sqlCommand, row);
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
using System;
using System.Configuration;
using Rhino.Etl.Core.Operations;

namespace Rhino.Etl.Core.ConventionOperations
{
using System;
using System.Configuration;
using Rhino.Etl.Core.Infrastructure;
using Rhino.Etl.Core.Operations;

/// <summary>Convertion wrapper around the <see cref="SqlBulkInsertOperation"/>.</summary>
public class ConventionSqlBulkInsertOperation : SqlBulkInsertOperation
{
/// <summary>Creates a new <see cref="ConventionSqlBulkInsertOperation"/></summary>
/// <param name="connectionStringName"></param>
/// <param name="targetTable"></param>
public ConventionSqlBulkInsertOperation(string connectionStringName, string targetTable) : this(ConfigurationManager.ConnectionStrings[connectionStringName], targetTable)
public ConventionSqlBulkInsertOperation(string connectionStringName, string targetTable)
: this(Use.ConnectionString(connectionStringName), targetTable)
{
}

Expand Down
11 changes: 5 additions & 6 deletions Rhino.Etl.Core/EtlProcess.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
using System.Configuration;
using Rhino.Etl.Core.Infrastructure;

namespace Rhino.Etl.Core
{
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using Operations;
using Pipelines;
using Rhino.Etl.Core.Infrastructure;
using Rhino.Etl.Core.Operations;
using Rhino.Etl.Core.Pipelines;

/// <summary>
/// A single etl process
Expand Down Expand Up @@ -134,7 +133,7 @@ protected virtual void OnRowProcessed(IOperation op, Row dictionary)
/// <returns></returns>
protected static T ExecuteScalar<T>(string connectionName, string commandText)
{
return ExecuteScalar<T>(ConfigurationManager.ConnectionStrings[connectionName], commandText);
return ExecuteScalar<T>(Use.ConnectionString(connectionName), commandText);
}

/// <summary>
Expand Down
71 changes: 71 additions & 0 deletions Rhino.Etl.Core/Infrastructure/ConnectionProvider.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
namespace Rhino.Etl.Core.Infrastructure
{
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Data.Common;

/// <summary>
/// Default <see cref="IConnectionProvider"/> implementation which depends on
/// application configuration file for connection string settings.
/// </summary>
public class ConnectionProvider : IConnectionProvider
{
private static IConnectionProvider _default;

/// <summary>
/// Gets or sets default <see cref="IConnectionProvider"/> instance.
/// </summary>
public static IConnectionProvider Default
{
get { return _default ?? (_default = new ConnectionProvider()); }
set { _default = value; }
}

/// <inheritdoc />
public ConnectionStringCollection ConnectionStrings { get; } = new ConnectionStringCollection();

/// <inheritdoc />
public virtual IDbConnection OpenConnection(string name)
{
var connectionString = ConnectionStrings[name];
if (connectionString == null)
throw new KeyNotFoundException("Could not find connnection string: " + name);

return OpenConnection(connectionString);
}

/// <inheritdoc />
public virtual IDbConnection OpenConnection(ConnectionStringSettings connectionString)
{
if (connectionString == null)
throw new ArgumentNullException(nameof(connectionString));
if (connectionString.ProviderName == null)
throw new ArgumentException("Null ProviderName specified", nameof(connectionString));

IDbConnection connection = null;

// Backwards compatibility: ProviderName could be an assembly qualified connection type name.
Type connectionType = Type.GetType(connectionString.ProviderName);
if (connectionType != null)
{
connection = Activator.CreateInstance(connectionType) as IDbConnection;
}

if (connection == null)
{
// ADO.NET compatible usage of provider name.
#if FEATURE_WESTWIND
connection = Westwind.Utilities.DataUtils.GetDbProviderFactory(connectionString.ProviderName.ToLowerInvariant()).CreateConnection();
#else
connection = DbProviderFactories.GetFactory(connectionString.ProviderName).CreateConnection();
#endif
}

connection.ConnectionString = connectionString.ConnectionString;
connection.Open();
return connection;
}
}
}
Loading