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

Netcore DTC #347

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"FSharp.fsacRuntime": "netcore"
}
Binary file not shown.
Binary file added lib/net46/Microsoft.SqlServer.Types.dll
Binary file not shown.
Binary file not shown.
Binary file added lib/netstandard2.0/Microsoft.SqlServer.Types.dll
Binary file not shown.
17 changes: 4 additions & 13 deletions netfx.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. -->
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- F# TP SDK STUFF -->
<PropertyGroup>
<!-- When compiling .NET SDK 2.0 projects targeting .NET 4.x on Mono using 'dotnet build' you -->
<!-- have to teach MSBuild where the Mono copy of the reference asssemblies is -->
Expand All @@ -27,25 +26,17 @@
<AssemblySearchPaths Condition="'$(BaseFrameworkPathOverrideForMono)' != ''">$(FrameworkPathOverride)/Facades;$(AssemblySearchPaths)</AssemblySearchPaths>

</PropertyGroup>

<ItemGroup>
<!-- When using 'dotnet build' to compile against Mono reference assemblies it seems necessary to add some explicit references to some facade DLLs -->
<Reference Include="System.Runtime" Condition="'$(BaseFrameworkPathOverrideForMono)' != '' AND $(TargetFramework.StartsWith('net4'))" />
<Reference Include="System.IO" Condition="'$(BaseFrameworkPathOverrideForMono)' != '' AND $(TargetFramework.StartsWith('net4'))" />

</ItemGroup>

<!-- F# SQL CLIENT STUFF -->
<PropertyGroup Condition="$(TargetFramework) == 'net461'">
<!--
Microsoft.SqlServer.Types is currently not available for netstandard,
USE_SQL_SERVER_TYPES_ASSEMBLY singles out code depending on it
-->
<DefineConstants>$(DefineConstants);USE_SQL_SERVER_TYPES_ASSEMBLY;USE_SYSTEM_DATA_COMMON_DBPROVIDERFACTORIES</DefineConstants>
<!-- F# SQL CLIENT STUFF -->
<PropertyGroup Condition="$(TargetFramework) != 'netcoreapp2.0'">
<!-- System.Data.Common.DbProviderFactories is not available for netstandard2.0 -->
<DefineConstants>$(DefineConstants);USE_SYSTEM_DATA_COMMON_DBPROVIDERFACTORIES</DefineConstants>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="System.Data.SqlClient" Version="4.5.1" Condition="'$(TargetFramework)' != 'net40'" />
</ItemGroup>

</Project>
14 changes: 1 addition & 13 deletions paket.dependencies
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,14 @@ group Build

nuget NuGet.CommandLine

group DesignTime
source https://www.nuget.org/api/v2/
framework: >= net461,netstandard20

nuget System.Configuration.ConfigurationManager
nuget System.Data.Common
nuget System.Data.SqlClient
nuget System.Runtime.Caching
nuget FSharp.Core
nuget Microsoft.SqlServer.TransactSql.ScriptDom
nuget Microsoft.SqlServer.Types

group Test
source https://www.nuget.org/api/v2/
framework: net461, netcoreapp2.0

nuget FSharp.Core = 4.5.2
nuget System.Data.SqlClient
nuget System.Configuration.ConfigurationManager

nuget Microsoft.SqlServer.Types ~> 12
nuget Newtonsoft.Json
nuget xunit = 2.4.1
Expand Down
201 changes: 43 additions & 158 deletions paket.lock

Large diffs are not rendered by default.

55 changes: 22 additions & 33 deletions src/SqlClient.DesignTime/SqlClient.DesignTime.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,31 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\netfx.props" />
<PropertyGroup>
<TargetFrameworks>net461;netstandard2.0</TargetFrameworks>
<TargetFrameworks>net461;netcoreapp2.0;netcoreapp2.1</TargetFrameworks>
<AssemblyName>FSharp.Data.SqlClient.DesignTime</AssemblyName>
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<NoWarn>101</NoWarn>
<DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>
<DisableImplicitSystemValueTupleReference>true</DisableImplicitSystemValueTupleReference>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="FSharp.Core" Version="4.1.18" Condition="'$(TargetFramework)' == 'net40'" />
<PackageReference Include="FSharp.Core" Version="4.3.4" Condition="'$(TargetFramework)' == 'net461'" />
<!--<PackageReference Include="System.Configuration.ConfigurationManager" Version="4.5.0" Condition="'$(TargetFramework)' == 'net461'" />

<PackageReference Include="Microsoft.SqlServer.TransactSql.ScriptDom" Version="14.0.3811.1" />
<PackageReference Include="Microsoft.SqlServer.Types" Version="12.0.5000" />
<PackageReference Include="System.Data.SqlClient" Version="4.5.1" Condition="'$(TargetFramework)' == 'net461'" />
<PackageReference Include="System.Data.SqlClient" Version="4.5.1" Condition="'$(TargetFramework)' == 'netstandard'" />

-->
</ItemGroup>
<!--<ItemGroup Condition="$(TargetFramework) == 'net40'">
<Reference Include="System.Configuration" />
<Reference Include="System.Data" />
</ItemGroup>
<ItemGroup>
<Reference Include="System.IdentityModel" />
<Reference Include="System.Runtime.Caching" />
<Reference Include="System.ServiceModel" />
<Reference Include="System.Transactions" />
<Reference Include="System.Xml" />
</ItemGroup>-->
<ItemGroup Condition="$(TargetFramework) == 'net461'">
<Reference Include="System.Data" />
<PackageReference Include="FSharp.Core" Version="4.3.4" />
<PackageReference Include="System.Data.SqlClient" Version="4.6.0" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="4.5.0" />
<PackageReference Include="System.Runtime.Caching" Version="4.5.0" />
<Reference Include="Microsoft.SqlServer.Types" Condition="'$(TargetFramework)'=='net461'">
<HintPath>../../lib/net46/Microsoft.SqlServer.Types.dll</HintPath>
</Reference>
<Reference Include="Microsoft.SqlServer.TransactSql.ScriptDom" Condition="'$(TargetFramework)'=='net461'">
<HintPath>../../lib/net46/Microsoft.SqlServer.TransactSql.ScriptDom.dll</HintPath>
</Reference>
<Reference Include="Microsoft.SqlServer.Types" Condition="'$(TargetFramework)'!='net461'">
<HintPath>../../lib/netstandard2.0/Microsoft.SqlServer.Types.dll</HintPath>
</Reference>
<Reference Include="Microsoft.SqlServer.TransactSql.ScriptDom" Condition="'$(TargetFramework)'!='net461'">
<HintPath>../../lib/netstandard2.0/Microsoft.SqlServer.TransactSql.ScriptDom.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="AssemblyInfo.fs" />
Expand Down Expand Up @@ -70,17 +61,15 @@
<Target Name="CopyAssembliesToTPFolder" AfterTargets="Build">
<ItemGroup>
<DesignTimeAssemblies Include="$(OutputPath)\FSharp.Data.SqlClient.DesignTime.*" />
<DesignTimeAssemblies Include="$(OutputPath)\Microsoft.SqlServer.*.dll" />
</ItemGroup>
<DesignTimeAssemblies Include="$(OutputPath)\Microsoft.SqlServer.*.dll" />
</ItemGroup>
<Copy SourceFiles="@(DesignTimeAssemblies)" DestinationFolder="..\..\bin\typeproviders\fsharp41\$(TargetFramework)" />
</Target>
<Target Name="CopyAssembliesToLegacyFolder" AfterTargets="Build" Condition="$(TargetFramework) == 'net40'">
<!-- <Target Name="CopyAssembliesToLegacyFolder" AfterTargets="Build" Condition="$(TargetFramework) == 'net40'">
<ItemGroup>
<DesignTimeAssemblies Include="$(OutputPath)\FSharp.Data.SqlClient.DesignTime.*" />
<DesignTimeAssemblies Include="$(OutputPath)\Microsoft.SqlServer.*.dll" />
<DesignTimeAssemblies Include="$(OutputPath)\Microsoft.SqlServer.*.dll" />
</ItemGroup>
<Copy SourceFiles="@(DesignTimeAssemblies)" DestinationFolder="..\..\bin\$(TargetFramework)" />
</Target>

<Import Project="..\..\.paket\Paket.Restore.targets" />
</Target> -->
</Project>
3 changes: 1 addition & 2 deletions src/SqlClient.DesignTime/SqlCommandProvider.fs
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,10 @@ open ProviderImplementation.ProvidedTypes
[<assembly:InternalsVisibleTo("SqlClient.DesignTime.Tests")>]
do()

#if USE_SQL_SERVER_TYPES_ASSEMBLY
module X =
// need to make sure microsoft.sqlserver.types is included as a referenced assembly
let x = Microsoft.SqlServer.Types.SqlHierarchyId()
#endif

[<TypeProvider>]
[<CompilerMessageAttribute("This API supports the FSharp.Data.SqlClient infrastructure and is not intended to be used directly from your code.", 101, IsHidden = true)>]
type SqlCommandProvider(config : TypeProviderConfig) as this =
Expand Down
1 change: 0 additions & 1 deletion src/SqlClient.DesignTime/SqlEnumProvider.fs
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,6 @@ type SqlEnumProvider(config : TypeProviderConfig) as this =

tempAssembly.AddTypes [ providedEnumType ]
providedEnumType

#endif

//Quotation factories
Expand Down
10 changes: 0 additions & 10 deletions src/SqlClient.DesignTime/paket.references

This file was deleted.

1 change: 1 addition & 0 deletions src/SqlClient/SqlClient.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
<ItemGroup>
<PackageReference Include="FSharp.Core" Version="4.1.18" Condition="'$(TargetFramework)' == 'net40'" />
<PackageReference Include="FSharp.Core" Version="4.3.4" Condition="'$(TargetFramework)' != 'net40'" />
<PackageReference Include="System.Data.SqlClient" Version="4.5.1" Condition="'$(TargetFramework)' != 'net40'" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="4.5.0" Condition="'$(TargetFramework)' != 'net40'" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net40'">
Expand Down
2 changes: 1 addition & 1 deletion tests/SqlClient.Tests/TransactionTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ let doNotOpenConnectionOnObjectForAsyncNonQuery() =
use conn = new SqlConnection(ConnectionStrings.AdventureWorks)
use cmd = new NonQuery(conn)
// should unwrap the aggregateexception here; not taking that on right now
Assert.Throws<AggregateException>(fun() -> cmd.AsyncExecute() |> Async.RunSynchronously |> ignore)
Assert.Throws<AggregateException>(fun() -> cmd.AsyncExecute() |> Async.RunSynchronously |> ignore)

[<Fact>]
let prematurelyOpenConnection() =
Expand Down