Skip to content

Commit

Permalink
Merge pull request #12 from zahirsolak/master
Browse files Browse the repository at this point in the history
Upgraded .net framework to v4.0 and fixed string format bugs.
  • Loading branch information
ayende authored Dec 21, 2016
2 parents 3d8974d + f8f73cd commit f05d94c
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 17 deletions.
10 changes: 8 additions & 2 deletions Rhino.Etl.Cmd/Rhino.Etl.Cmd.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<IsWebBootstrapper>false</IsWebBootstrapper>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
Expand All @@ -31,6 +31,7 @@
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand Down Expand Up @@ -88,7 +89,6 @@
<ItemGroup>
<Compile Include="RhinoEtlRunner.cs" />
<Compile Include="RhinoEtlSetup.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="RhinoEtlCommandLineOptions.cs" />
</ItemGroup>
<ItemGroup>
Expand Down Expand Up @@ -137,6 +137,12 @@
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<Folder Include="Properties\" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
</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.
Expand Down
3 changes: 3 additions & 0 deletions Rhino.Etl.Cmd/app.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?xml version="1.0"?>
<configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
16 changes: 12 additions & 4 deletions Rhino.Etl.Core/Operations/SqlBulkInsertOperation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ private SqlBulkCopy CreateSqlBulkCopy(SqlConnection connection, SqlTransaction t
private void CompareSqlColumns(SqlConnection connection, SqlTransaction transaction, IEnumerable<Row> rows)
{
var command = connection.CreateCommand();
command.CommandText = $"select * from {TargetTable} where 1=0";
command.CommandText = "select * from {TargetTable} where 1=0".Replace("{TargetTable}", TargetTable);
command.CommandType = CommandType.Text;
command.Transaction = transaction;

Expand Down Expand Up @@ -326,9 +326,13 @@ private void CompareSqlColumns(SqlConnection connection, SqlTransaction transact
throw new InvalidOperationException(
"The following columns have different types in the target table: " +
string.Join(", ", differentColumns
.Select(c => $"{c.Name}: is {GetFriendlyName(c.SchemaType)}, but should be {GetFriendlyName(c.DatabaseType.Type)}{(c.DatabaseType.IsNullable ? "?" : "")}.")
//.Select(c => $"{c.Name}: is {GetFriendlyName(c.SchemaType)}, but should be {GetFriendlyName(c.DatabaseType.Type)}{(c.DatabaseType.IsNullable ? "?" : "")}.")
// c.Name, GetFriendlyName(c.SchemaType), GetFriendlyName(c.DatabaseType.Type), (c.DatabaseType.IsNullable ? \"?\" : \"\")
.Select(c => string.Format("{0}: is {1}, but should be {2}{3}.", c.Name,
GetFriendlyName(c.SchemaType), GetFriendlyName(c.DatabaseType.Type),
(c.DatabaseType.IsNullable ? "?" : "")))
.ToArray()
));
));
var stringsTooLong =
(from column in databaseColumns
where column.Type == typeof(string)
Expand All @@ -344,7 +348,11 @@ from row in rows
throw new InvalidOperationException(
"The folowing columns have values too long for the target table: " +
string.Join(", ", stringsTooLong
.Select(s => $"{s.Name}: max length is {s.MaxLength}, value is {s.Value}.")
.Select(s => "{s.Name}: max length is {s.MaxLength}, value is {s.Value}."
.Replace("{s.Name}", s.Name)
.Replace("{s.MaxLength}", s.MaxLength.ToString())
.Replace("{s.Value}", s.Value)
)
.ToArray()));
}
}
Expand Down
10 changes: 7 additions & 3 deletions Rhino.Etl.Core/Rhino.Etl.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand All @@ -43,6 +44,7 @@
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<DocumentationFile>Rhino.Etl.Core.XML</DocumentationFile>
<NoWarn>1607</NoWarn>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
Expand All @@ -52,6 +54,7 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>Rhino.Etl.Core.XML</DocumentationFile>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="Boo.Lang">
Expand Down Expand Up @@ -125,7 +128,6 @@
<Compile Include="Operations\SqlBulkInsertOperation.cs" />
<Compile Include="Pipelines\SingleThreadedPipelineExecuter.cs" />
<Compile Include="Exceptions\RhinoEtlException.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="QuackingDictionary.cs" />
<Compile Include="Row.cs" />
<Compile Include="RuntimeInfo.cs" />
Expand All @@ -151,7 +153,9 @@
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<ItemGroup />
<ItemGroup>
<Folder Include="Properties\" />
</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.
Expand Down
7 changes: 5 additions & 2 deletions Rhino.Etl.Dsl/Rhino.Etl.Dsl.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand Down Expand Up @@ -101,7 +102,6 @@
<Compile Include="Macros\RowProcessedMacro.cs" />
<Compile Include="Macros\SqlBulkInsertMacro.cs" />
<Compile Include="Macros\TerminateMacro.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Rhino.Etl.Core\Rhino.Etl.Core.csproj">
Expand Down Expand Up @@ -129,6 +129,9 @@
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<Folder Include="Properties\" />
</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.
Expand Down
8 changes: 3 additions & 5 deletions Rhino.Etl.Tests/App.config
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0"?>
<configuration>
<connectionStrings>
<add name="test"
connectionString="Data Source=.\SQLExpress;Initial Catalog=test;Integrated Security=SSPI;Timeout=30;"
providerName="System.Data.SqlClient.SqlConnection, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
<add name="test" connectionString="Data Source=.\SQLExpress;Initial Catalog=test;Integrated Security=SSPI;Timeout=30;" providerName="System.Data.SqlClient.SqlConnection, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
</connectionStrings>
</configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
3 changes: 2 additions & 1 deletion Rhino.Etl.Tests/Rhino.Etl.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand Down

0 comments on commit f05d94c

Please sign in to comment.