Unverified Commit 1481c4d3 authored by Nick Craver's avatar Nick Craver Committed by GitHub

Tooling and project updates (#1333)

This is a branch cleaning up old `#if` clauses, `.csproj` bits, Linux build compatibility, and a few other tid-bits (broken out by commit).

In general: we're on 3.0 tooling and all previous cruft has been removed.
parent 7cac3824
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<AssemblyName>Dapper.Contrib</AssemblyName>
<PackageTags>orm;sql;micro-orm;dapper</PackageTags>
<Title>Dapper.Contrib</Title>
<PackageTags>orm;sql;micro-orm;dapper</PackageTags>
<Description>The official collection of get, insert, update and delete helpers for Dapper.net. Also handles lists of entities and optional "dirty" tracking of interface-based entities.</Description>
<Authors>Sam Saffron;Johan Danforth</Authors>
<TargetFrameworks>net461;netstandard2.0</TargetFrameworks>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\Dapper\TypeExtensions.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Dapper\Dapper.csproj" />
</ItemGroup>
......
......@@ -6,15 +6,10 @@
using System.Text;
using System.Collections.Concurrent;
using System.Reflection.Emit;
using System.Threading;
using Dapper;
#if NETSTANDARD1_3
using DataException = System.InvalidOperationException;
#else
using System.Threading;
#endif
namespace Dapper.Contrib.Extensions
{
/// <summary>
......@@ -290,15 +285,10 @@ private static string GetTableName(Type type)
}
else
{
#if NETSTANDARD1_3
var info = type.GetTypeInfo();
#else
var info = type;
#endif
//NOTE: This as dynamic trick falls back to handle both our own Table-attribute as well as the one in EntityFramework
var tableAttrName =
info.GetCustomAttribute<TableAttribute>(false)?.Name
?? (info.GetCustomAttributes(false).FirstOrDefault(attr => attr.GetType().Name == "TableAttribute") as dynamic)?.Name;
type.GetCustomAttribute<TableAttribute>(false)?.Name
?? (type.GetCustomAttributes(false).FirstOrDefault(attr => attr.GetType().Name == "TableAttribute") as dynamic)?.Name;
if (tableAttrName != null)
{
......@@ -562,7 +552,7 @@ private static class ProxyGenerator
private static AssemblyBuilder GetAsmBuilder(string name)
{
#if NETSTANDARD1_3 || NETSTANDARD2_0
#if NETSTANDARD2_0
return AssemblyBuilder.DefineDynamicAssembly(new AssemblyName { Name = name }, AssemblyBuilderAccess.Run);
#else
return Thread.GetDomain().DefineDynamicAssembly(new AssemblyName { Name = name }, AssemblyBuilderAccess.Run);
......@@ -597,7 +587,7 @@ public static T GetInterfaceProxy<T>()
CreateProperty<T>(typeBuilder, property.Name, property.PropertyType, setIsDirtyMethod, isId);
}
#if NETSTANDARD1_3 || NETSTANDARD2_0
#if NETSTANDARD2_0
var generatedType = typeBuilder.CreateTypeInfo().AsType();
#else
var generatedType = typeBuilder.CreateType();
......
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<AssemblyName>Dapper.ProviderTools</AssemblyName>
<PackageTags>orm;sql;micro-orm</PackageTags>
<Title>Dapper Provider Tools</Title>
......@@ -13,8 +10,10 @@
<Nullable>enable</Nullable>
<LangVersion>8.0</LangVersion>
</PropertyGroup>
<ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
<PackageReference Include="Microsoft.CSharp" Version="4.5.0" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net461' ">
<Reference Include="Microsoft.CSharp" />
</ItemGroup>
</Project>
......@@ -10,13 +10,9 @@
<!-- TODO: Docs -->
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\Dapper\TypeExtensions.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Dapper\Dapper.csproj" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
<PackageReference Include="Microsoft.CSharp" Version="4.5.0" />
</ItemGroup>
......
......@@ -12,7 +12,6 @@
<ItemGroup>
<ProjectReference Include="..\Dapper\Dapper.csproj" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
<PackageReference Include="Microsoft.CSharp" Version="4.5.0" />
</ItemGroup>
......
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<AssemblyName>Dapper.Tests.Contrib</AssemblyName>
<Title>Dapper.Tests.Contrib</Title>
<Description>Dapper Contrib Test Suite</Description>
<DebugType>portable</DebugType>
<OutputType>Exe</OutputType>
<GenerateDocumentationFile>false</GenerateDocumentationFile>
<TargetFrameworks>netcoreapp2.0</TargetFrameworks>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\Dapper.Tests\Helpers\XunitSkippable.cs;..\Dapper\TypeExtensions.cs" />
......@@ -19,12 +17,12 @@
<PackageReference Include="Microsoft.Data.Sqlite" Version="2.2.6" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
<PackageReference Include="MySqlConnector" Version="0.56.0" />
<PackageReference Include="System.Data.SqlClient" Version="4.6.1" />
<PackageReference Include="xunit" Version="$(xUnitVersion)" />
<PackageReference Include="xunit.runner.visualstudio" Version="$(xUnitVersion)">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="System.Data.SqlClient" Version="4.6.1" />
</ItemGroup>
<!-- note: define SQLCE if SQL CE is available -->
</Project>
using System.ComponentModel;
#if NET4X
using System.ComponentModel;
using BenchmarkDotNet.Attributes;
using Dapper.Tests.Performance.Dashing;
using Dashing;
......@@ -19,7 +20,10 @@ public void Setup()
Session = database.BeginTransactionLessSession(_connection);
}
[Benchmark(Description = "Get")]
// This needs love to be compatible with current SDKs (weaving doesn't work and shouldn't be used here anyway (competition).
// I'll file an issue with Dashing to see if someone can help me out here since I can't figure out from the docs how to
// make it work correctly.
//[Benchmark(Description = "Get")]
public Dashing.Post Get()
{
Step();
......@@ -27,3 +31,4 @@ public Dashing.Post Get()
}
}
}
#endif
using BenchmarkDotNet.Attributes;
#if NET4X
using BenchmarkDotNet.Attributes;
using System.ComponentModel;
using System.Linq;
......@@ -38,3 +39,4 @@ public Post NoTracking()
}
}
}
#endif
......@@ -11,18 +11,15 @@ public class HandCodedBenchmarks : BenchmarkBase
{
private SqlCommand _postCommand;
private SqlParameter _idParam;
#if !NETCOREAPP1_0
private DataTable _table;
#endif
[GlobalSetup]
public void Setup()
{
BaseSetup();
_postCommand = new SqlCommand("select * from Posts where Id = @Id", _connection);
_postCommand = new SqlCommand("select Top 1 * from Posts where Id = @Id", _connection);
_idParam = _postCommand.Parameters.Add("@Id", SqlDbType.Int);
_postCommand.Prepare();
#if !NETCOREAPP1_0
_table = new DataTable
{
Columns =
......@@ -42,7 +39,6 @@ public void Setup()
{"Counter9", typeof (int)},
}
};
#endif
}
[Benchmark(Description = "SqlCommand")]
......
using BenchmarkDotNet.Attributes;
#if NET4X
using BenchmarkDotNet.Attributes;
using Dapper.Tests.Performance.Linq2Sql;
using System;
using System.ComponentModel;
......@@ -44,3 +45,4 @@ public Post ExecuteQuery()
}
}
}
#endif
using BenchmarkDotNet.Attributes;
#if NET4X
using BenchmarkDotNet.Attributes;
using Susanoo;
using Susanoo.Processing;
using System.ComponentModel;
......@@ -64,3 +65,4 @@ public dynamic MappingStaticDynamic()
}
}
}
#endif
......@@ -28,8 +28,8 @@ public Config()
Add(TargetMethodColumn.Method);
Add(new ReturnColum());
Add(StatisticColumn.Mean);
//Add(StatisticColumn.StdDev);
//Add(StatisticColumn.Error);
Add(StatisticColumn.StdDev);
Add(StatisticColumn.Error);
Add(BaselineRatioColumn.RatioMean);
Add(DefaultColumnProviders.Metrics);
......@@ -37,7 +37,7 @@ public Config()
.WithLaunchCount(1)
.WithWarmupCount(2)
.WithUnrollFactor(Iterations)
.WithIterationCount(1)
.WithIterationCount(10)
);
Orderer = new DefaultOrderer(SummaryOrderPolicy.FastestToSlowest);
Options |= ConfigOptions.JoinSummary;
......
<Project>
<Import Sdk="Microsoft.NET.Sdk" Project="Sdk.props" />
<PropertyGroup>
<AssemblyName>Dapper.Tests.Performance</AssemblyName>
<Title>Dapper.Tests.Performance</Title>
<Description>Dapper Core Performance Suite</Description>
<OutputType>Exe</OutputType>
<GenerateDocumentationFile>false</GenerateDocumentationFile>
<TargetFrameworks>net462</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Dapper\Dapper.csproj" />
<ProjectReference Include="..\Dapper.Contrib\Dapper.Contrib.csproj" />
<ProjectReference Include="..\Dapper.EntityFramework\Dapper.EntityFramework.csproj" />
<PackageReference Include="Dashing" Version="2.2.0" />
<PackageReference Include="Dashing.Weaver" Version="2.2.0" />
<PackageReference Include="Belgrade.Sql.Client" Version="1.1.4" />
<PackageReference Include="BenchmarkDotNet" Version="0.11.5" />
<PackageReference Include="DevExpress.Xpo" Version="19.1.5" />
<!--<PackageReference Include="BLToolkit" Version="4.3.6" />-->
<PackageReference Include="EntityFramework" Version="6.2.0" />
<PackageReference Include="FirebirdSql.Data.FirebirdClient" Version="7.0.0" />
<PackageReference Include="linq2db.SqlServer" Version="2.9.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.2.6" />
<PackageReference Include="Microsoft.SqlServer.Types" Version="14.0.1016.290" />
<PackageReference Include="MySqlConnector" Version="0.56.0" />
<PackageReference Include="NHibernate" Version="5.2.5" />
<PackageReference Include="Iesi.Collections" Version="4.0.4" />
<PackageReference Include="Npgsql" Version="4.0.9" />
<PackageReference Include="PetaPoco" Version="5.1.306" />
<PackageReference Include="ServiceStack.OrmLite.SqlServer.Signed" Version="4.5.14" />
<PackageReference Include="Soma" Version="1.9.0.1" />
<PackageReference Include="SubSonic" Version="3.0.0.4" />
<PackageReference Include="Susanoo.SqlServer" Version="1.2.4.2" />
<PackageReference Include="System.Data.SQLite" Version="1.0.111" />
<Reference Include="System.Configuration" />
<Reference Include="System.Data" />
<Reference Include="System.Data.Linq" />
<Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>
<ItemGroup>
<None Update="NHibernate\*.xml" CopyToOutputDirectory="Always" />
<Compile Update="Benchmarks.*.cs" DependentUpon="Benchmarks.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Update="SourceLink.Create.GitHub" Version="2.8.3" />
</ItemGroup>
<Import Sdk="Microsoft.NET.Sdk" Project="Sdk.targets" />
<PropertyGroup>
<WeaveArguments>-p "$(MSBuildThisFileDirectory)$(OutputPath)$(AssemblyName).exe" -t "Dapper.Tests.Performance.Dashing.DashingConfiguration"</WeaveArguments>
</PropertyGroup>
</Project>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<AssemblyName>Dapper.Tests.Performance</AssemblyName>
<Title>Dapper.Tests.Performance</Title>
<Description>Dapper Core Performance Suite</Description>
<OutputType>Exe</OutputType>
<GenerateDocumentationFile>false</GenerateDocumentationFile>
<TargetFrameworks>net462;netcoreapp3.0</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Dapper\Dapper.csproj" />
<ProjectReference Include="..\Dapper.Contrib\Dapper.Contrib.csproj" />
<PackageReference Include="Dashing" Version="2.2.0" />
<PackageReference Include="Belgrade.Sql.Client" Version="1.1.4" />
<PackageReference Include="BenchmarkDotNet" Version="0.11.5" />
<PackageReference Include="DevExpress.Xpo" Version="19.1.5" />
<!--<PackageReference Include="BLToolkit" Version="4.3.6" />-->
<PackageReference Include="FirebirdSql.Data.FirebirdClient" Version="7.0.0" />
<PackageReference Include="linq2db.SqlServer" Version="2.9.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.2.6" />
<PackageReference Include="MySqlConnector" Version="0.56.0" />
<PackageReference Include="NHibernate" Version="5.2.5" />
<PackageReference Include="Iesi.Collections" Version="4.0.4" />
<PackageReference Include="Npgsql" Version="4.0.9" />
<PackageReference Include="PetaPoco" Version="5.1.306" />
<PackageReference Include="ServiceStack.OrmLite.SqlServer" Version="5.6.0" />
<PackageReference Include="System.Data.SQLite" Version="1.0.111" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="NHibernate\*.xml" />
<Compile Update="Benchmarks.*.cs" DependentUpon="Benchmarks.cs" />
</ItemGroup>
<PropertyGroup Condition="'$(TargetFramework)' == 'net462'">
<DefineConstants>$(DefineConstants);NET4X</DefineConstants>
</PropertyGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net462'">
<ProjectReference Include="..\Dapper.EntityFramework\Dapper.EntityFramework.csproj" />
<PackageReference Include="EntityFramework" Version="6.2.0" />
<PackageReference Include="Microsoft.SqlServer.Types" Version="14.0.1016.290" />
<PackageReference Include="Soma" Version="1.9.0.1" />
<PackageReference Include="SubSonic" Version="3.0.0.4" />
<PackageReference Include="Susanoo.SqlServer" Version="1.2.4.2" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Configuration" />
<Reference Include="System.Data.Linq" />
</ItemGroup>
</Project>
using System.Data.Common;
#if NET4X
using System.Data.Common;
using System.Data.Entity;
namespace Dapper.Tests.Performance.EntityFramework
......@@ -12,3 +13,4 @@ public EFContext(DbConnection connection, bool owned = false) : base(connection,
public DbSet<Post> Posts { get; set; }
}
}
#endif
This diff is collapsed.
#if !NETSTANDARD1_3
#if NET4X
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
......
#if !NETSTANDARD1_3
using System;
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Data;
......@@ -453,5 +452,4 @@ public virtual dynamic Single(object key, string columns = "*")
}
}
}
#pragma warning restore RCS1141 // Add parameter to documentation comment.
#endif
#pragma warning restore RCS1141 // Add parameter to documentation comment.
\ No newline at end of file
using NHibernate;
using System.Reflection;
using NHibernate;
using NHibernate.Cfg;
namespace Dapper.Tests.Performance.NHibernate
......@@ -14,9 +15,8 @@ private static ISessionFactory SessionFactory
if (_sessionFactory == null)
{
var configuration = new Configuration();
configuration.Configure(@".\NHibernate\hibernate.cfg.xml");
configuration.Configure(Assembly.GetExecutingAssembly(), "Dapper.Tests.Performance.NHibernate.hibernate.cfg.xml");
configuration.AddAssembly(typeof(Post).Assembly);
configuration.AddXmlFile(@".\NHibernate\Post.hbm.xml");
_sessionFactory = configuration.BuildSessionFactory();
}
......@@ -29,4 +29,4 @@ public static IStatelessSession OpenSession()
return SessionFactory.OpenStatelessSession();
}
}
}
\ No newline at end of file
}
#if !NETSTANDARD1_3
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
......@@ -1442,5 +1441,4 @@ public void Build(StringBuilder sb, List<object> args, Sql lhs)
}
}
}
#pragma warning restore RCS1023 // Format empty block.
#endif
#pragma warning restore RCS1023 // Format empty block.
\ No newline at end of file
using System;
#if NET4X
using Soma.Core;
#endif
namespace Dapper.Tests.Performance
{
[ServiceStack.DataAnnotations.Alias("Posts")]
#if NET4X
[Table(Name = "Posts")]
#endif
[LinqToDB.Mapping.Table(Name = "Posts")]
public class Post
{
#if NET4X
[Id(IdKind.Identity)]
#endif
[LinqToDB.Mapping.PrimaryKey, LinqToDB.Mapping.Identity]
public int Id { get; set; }
[LinqToDB.Mapping.Column, LinqToDB.Mapping.Nullable]
public string Text { get; set; }
[LinqToDB.Mapping.Column, LinqToDB.Mapping.NotNull]
public DateTime CreationDate { get; set; }
[LinqToDB.Mapping.Column, LinqToDB.Mapping.NotNull]
public DateTime LastChangeDate { get; set; }
[LinqToDB.Mapping.Column, LinqToDB.Mapping.Nullable]
public int? Counter1 { get; set; }
[LinqToDB.Mapping.Column, LinqToDB.Mapping.Nullable]
public int? Counter2 { get; set; }
[LinqToDB.Mapping.Column, LinqToDB.Mapping.Nullable]
public int? Counter3 { get; set; }
[LinqToDB.Mapping.Column, LinqToDB.Mapping.Nullable]
public int? Counter4 { get; set; }
[LinqToDB.Mapping.Column, LinqToDB.Mapping.Nullable]
public int? Counter5 { get; set; }
[LinqToDB.Mapping.Column, LinqToDB.Mapping.Nullable]
public int? Counter6 { get; set; }
[LinqToDB.Mapping.Column, LinqToDB.Mapping.Nullable]
public int? Counter7 { get; set; }
[LinqToDB.Mapping.Column, LinqToDB.Mapping.Nullable]
public int? Counter8 { get; set; }
[LinqToDB.Mapping.Column, LinqToDB.Mapping.Nullable]
public int? Counter9 { get; set; }
}
}
using Soma.Core;
#if NET4X
using Soma.Core;
using System;
namespace Dapper.Tests.Performance.Soma
......@@ -12,3 +13,4 @@ internal class SomaConfig : MsSqlConfig
private static readonly Action<PreparedStatement> noOp = x => { /* nope */ };
}
}
#endif
using System;
using System.Data.SqlClient;
using System.Runtime.CompilerServices;
namespace Dapper.Tests.Performance
{
public static class SqlDataReaderHelper
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static string GetNullableString(this SqlDataReader reader, int index)
{
object tmp = reader.GetValue(index);
......@@ -15,6 +17,7 @@ public static string GetNullableString(this SqlDataReader reader, int index)
return null;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static T? GetNullableValue<T>(this SqlDataReader reader, int index) where T : struct
{
object tmp = reader.GetValue(index);
......
......@@ -282,7 +282,6 @@ public async Task TestMultiClosedConnAsyncViaFirstOrDefault()
}
}
#if !NETCOREAPP1_0
[Fact]
public async Task ExecuteReaderOpenAsync()
{
......@@ -311,7 +310,6 @@ public async Task ExecuteReaderClosedAsync()
Assert.Equal(4, (int)dt.Rows[0][1]);
}
}
#endif
[Fact]
public async Task LiteralReplacementOpen()
......
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<AssemblyName>Dapper.Tests</AssemblyName>
<Title>Dapper.Tests</Title>
<Description>Dapper Core Test Suite</Description>
<GenerateDocumentationFile>false</GenerateDocumentationFile>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
<TargetFrameworks>netcoreapp2.1;net462;net472</TargetFrameworks>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<DefineConstants>$(DefineConstants);MSSQLCLIENT</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)' == 'net462' OR '$(TargetFramework)' == 'net472'">
<DefineConstants>$(DefineConstants);ENTITY_FRAMEWORK;LINQ2SQL;OLEDB</DefineConstants>
</PropertyGroup>
<ItemGroup>
<None Remove="Test.DB.sdf" />
</ItemGroup>
<PropertyGroup>
<DefineConstants>$(DefineConstants);MSSQLCLIENT</DefineConstants>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.Data.SqlClient" Version="4.6.1" />
<PackageReference Include="Microsoft.Data.SqlClient" Version="1.0.19239.1" />
<PackageReference Include="Microsoft.SqlServer.Types" Version="14.0.1016.290" Condition="'$(TargetFramework)' == 'net462' OR '$(TargetFramework)' == 'net472'" />
</ItemGroup>
<ItemGroup Condition="'$(Platform)'=='x64'">
<Content Include="$(USERPROFILE)\.nuget\packages\microsoft.sqlserver.types\14.0.1016.290\nativeBinaries\x64\*.dll" Condition="'$(TargetFramework)' == 'net462' OR '$(TargetFramework)' == 'net472'">
<Link>%(Filename)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup Condition="'$(Platform)'=='x86'">
<Content Include="$(USERPROFILE)\.nuget\packages\microsoft.sqlserver.types\14.0.1016.290\nativeBinaries\x86\*.dll" Condition="'$(TargetFramework)' == 'net462' OR '$(TargetFramework)' == 'net472'">
<Link>%(Filename)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Dapper.ProviderTools\Dapper.ProviderTools.csproj" />
<ProjectReference Include="..\Dapper\Dapper.csproj" />
<ProjectReference Include="..\Dapper.Contrib\Dapper.Contrib.csproj" />
<ProjectReference Include="..\Dapper.ProviderTools\Dapper.ProviderTools.csproj" />
<PackageReference Include="FirebirdSql.Data.FirebirdClient" Version="7.0.0" />
<PackageReference Include="Microsoft.Data.SqlClient" Version="1.0.19239.1" />
<PackageReference Include="Microsoft.Data.Sqlite" Version="2.2.6" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
<PackageReference Include="MySqlConnector" Version="0.56.0" />
<PackageReference Include="Npgsql" Version="4.0.9" />
<PackageReference Include="System.Data.SqlClient" Version="4.6.1" />
<PackageReference Include="System.ValueTuple" Version="4.5.0" />
<PackageReference Include="xunit" Version="$(xUnitVersion)" />
<PackageReference Include="xunit.runner.visualstudio" Version="$(xUnitVersion)">
......@@ -56,22 +33,11 @@
<ItemGroup Condition="'$(TargetFramework)' == 'net462' OR '$(TargetFramework)' == 'net472'">
<ProjectReference Include="..\Dapper.EntityFramework\Dapper.EntityFramework.csproj" />
<PackageReference Include="Microsoft.Data.Sqlite" Version="1.1.1" />
<PackageReference Include="Microsoft.SqlServer.Types" Version="14.0.1016.290" />
<!--<PackageReference Include="Oracle.ManagedDataAccess" Version="19.3.1" />-->
<Reference Include="System.Configuration" />
<Reference Include="System.Data" />
<Reference Include="System.Data.Linq" />
<Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp2.1'">
<PackageReference Include="Microsoft.Data.Sqlite" Version="2.2.6" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp3.0'">
<PackageReference Include="Microsoft.Data.Sqlite" Version="2.2.6" />
<ItemGroup>
<!-- Conditionals make the tooling go crazy...just include them for this test project -->
<Content Include="$(NuGetPackageRoot)\microsoft.sqlserver.types\14.0.1016.290\nativeBinaries\**\*.dll" CopyToOutputDirectory="PreserveNewest" />
<None Remove="Test.DB.sdf" />
</ItemGroup>
</Project>
......@@ -20,12 +20,15 @@ public static void If<T>(object obj, string reason = null)
if (obj is T) Skip.Inconclusive(reason ?? $"not valid for {typeof(T).FullName}");
}
}
#pragma warning disable RCS1194 // Implement exception constructors.
public class SkipTestException : Exception
{
public SkipTestException(string reason) : base(reason)
{
}
}
#pragma warning restore RCS1194 // Implement exception constructors.
public class FactDiscoverer : Xunit.Sdk.FactDiscoverer
{
......
......@@ -4,38 +4,11 @@
using System.Data;
using System.Data.Common;
using System.Diagnostics;
using System.Linq;
using Xunit;
#if NETCOREAPP1_0
using System.Collections;
using System.Dynamic;
using System.Data.SqlTypes;
#else // net452
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
#endif
#if NETCOREAPP1_0
namespace System
{
public enum GenericUriParserOptions
{
Default
}
public class GenericUriParser
{
private readonly GenericUriParserOptions options;
public GenericUriParser(GenericUriParserOptions options)
{
this.options = options;
}
}
}
#endif
using Xunit;
namespace Dapper.Tests
{
......@@ -523,7 +496,6 @@ public void TestInheritance()
Assert.Equal("Four", list.First().Base2);
}
#if !NETCOREAPP1_0
[Fact]
public void ExecuteReader()
{
......@@ -536,7 +508,6 @@ public void ExecuteReader()
Assert.Equal(3, (int)dt.Rows[0][0]);
Assert.Equal(4, (int)dt.Rows[0][1]);
}
#endif
[Fact]
public void TestDbString()
......
......@@ -522,7 +522,6 @@ public void TestSqlDataRecordListParametersWithTypeHandlers()
}
}
#if !NETCOREAPP1_0
[Fact]
public void DataTableParameters()
{
......@@ -698,7 +697,6 @@ public SO29596645_OrganisationDTO()
Rules = new SO29596645_RuleTableValuedParameters("@Rules");
}
}
#endif
#if ENTITY_FRAMEWORK
private class HazGeo
......
......@@ -112,9 +112,7 @@ @TaxInvoiceNumber nvarchar(20)
private class PracticeRebateOrders
{
public string fTaxInvoiceNumber;
#if !NETCOREAPP1_0
[System.Xml.Serialization.XmlElement(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
#endif
public string TaxInvoiceNumber
{
get { return fTaxInvoiceNumber; }
......
......@@ -30,25 +30,26 @@ public void ClientId_SystemDataSqlClient()
=> TestClientId<SystemSqlClientProvider>();
[Fact]
public void ClientId_MicrosoftDataSqlClient()
=> TestClientId<MicrosoftSqlClientProvider>();
public void ClearPool_SystemDataSqlClient()
=> ClearPool<SystemSqlClientProvider>();
[Fact]
public void ClearAllPools_SystemDataSqlClient()
=> ClearAllPools<SystemSqlClientProvider>();
#if MSSQLCLIENT
[Fact]
public void ClearPool_SystemDataSqlClient()
=> ClearPool<SystemSqlClientProvider>();
public void ClientId_MicrosoftDataSqlClient()
=> TestClientId<MicrosoftSqlClientProvider>();
[Fact]
public void ClearPool_MicrosoftDataSqlClient()
=> ClearPool<MicrosoftSqlClientProvider>();
[Fact]
public void ClearAllPools_SystemDataSqlClient()
=> ClearAllPools<SystemSqlClientProvider>();
[Fact]
public void ClearAllPools_MicrosoftDataSqlClient()
=> ClearAllPools<MicrosoftSqlClientProvider>();
#endif
private static void TestClientId<T>()
where T : SqlServerDatabaseProvider, new()
......@@ -97,11 +98,13 @@ private static void Test<T>(DbConnection connection)
public void DbNumber_SystemData(int create, int test, bool result)
=> Test<SystemSqlClientProvider>(create, test, result);
#if MSSQLCLIENT
[Theory]
[InlineData(51000, 51000, true)]
[InlineData(51000, 43, false)]
public void DbNumber_MicrosoftData(int create, int test, bool result)
=> Test<MicrosoftSqlClientProvider>(create, test, result);
#endif
private void Test<T>(int create, int test, bool result)
where T : SqlServerDatabaseProvider, new()
......
using System;
using System.Data;
using System.Globalization;
using Xunit;
using System.Data.Common;
#if !NETCOREAPP1_0
using System.Globalization;
using System.Threading;
#endif
using Xunit;
namespace Dapper.Tests
{
......@@ -93,13 +91,8 @@ protected void SkipIfMsDataClient()
protected static CultureInfo ActiveCulture
{
#if NETCOREAPP1_0
get { return CultureInfo.CurrentCulture; }
set { CultureInfo.CurrentCulture = value; }
#else
get { return Thread.CurrentThread.CurrentCulture; }
set { Thread.CurrentThread.CurrentCulture = value; }
#endif
}
static TestBase()
......@@ -109,9 +102,6 @@ static TestBase()
Console.WriteLine("Using Connectionstring: {0}", provider.GetConnectionString());
var factory = provider.Factory;
Console.WriteLine("Using Provider: {0}", factory.GetType().FullName);
#if NETCOREAPP1_0
Console.WriteLine("CoreCLR (netcoreapp1.0)");
#else
Console.WriteLine(".NET: " + Environment.Version);
Console.Write("Loading native assemblies for SQL types...");
try
......@@ -124,7 +114,6 @@ static TestBase()
Console.WriteLine("failed.");
Console.Error.WriteLine(ex.Message);
}
#endif
}
public virtual void Dispose()
......
......@@ -82,13 +82,8 @@ public void TestCustomTypeMap()
private static string GetDescriptionFromAttribute(MemberInfo member)
{
if (member == null) return null;
#if NETCOREAPP1_0
var data = member.CustomAttributes.FirstOrDefault(x => x.AttributeType == typeof(DescriptionAttribute));
return (string)data?.ConstructorArguments.Single().Value;
#else
var attrib = (DescriptionAttribute)Attribute.GetCustomAttribute(member, typeof(DescriptionAttribute), false);
return attrib?.Description;
#endif
}
public class TypeWithMapping
......
......@@ -8,13 +8,11 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
.editorconfig = .editorconfig
appveyor.yml = appveyor.yml
build.ps1 = build.ps1
Directory.build.props = Directory.build.props
global.json = global.json
docs\index.md = docs\index.md
License.txt = License.txt
nuget.config = nuget.config
Readme.md = Readme.md
semver.txt = semver.txt
version.json = version.json
EndProjectSection
EndProject
......@@ -36,7 +34,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dapper.Rainbow", "Dapper.Ra
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{4E956F6B-6BD8-46F5-BC85-49292FF8F9AB}"
ProjectSection(SolutionItems) = preProject
Directory.build.props = Directory.build.props
Directory.Build.props = Directory.Build.props
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{568BD46C-1C65-4D44-870C-12CD72563262}"
......
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<PackageId>Dapper</PackageId>
<PackageTags>orm;sql;micro-orm</PackageTags>
<AssemblyName>Dapper</AssemblyName>
<Title>Dapper</Title>
<PackageTags>orm;sql;micro-orm</PackageTags>
<Description>A high performance Micro-ORM supporting SQL Server, MySQL, Sqlite, SqlCE, Firebird etc..</Description>
<Authors>Sam Saffron;Marc Gravell;Nick Craver</Authors>
<TargetFrameworks>net461;netstandard2.0</TargetFrameworks>
......
......@@ -29,15 +29,10 @@ private async static Task<T> ThrowDisposedAsync<T>()
await Task.Yield(); // will never hit this - already thrown and handled
return result;
}
#if !NETSTANDARD1_3
public override void Close() { }
public override DataTable GetSchemaTable() => ThrowDisposed<DataTable>();
public override object InitializeLifetimeService() => ThrowDisposed<object>();
#endif
protected override void Dispose(bool disposing) { }
#if NET451
public override System.Runtime.Remoting.ObjRef CreateObjRef(Type requestedType) => ThrowDisposed<System.Runtime.Remoting.ObjRef>();
#endif
public override bool GetBoolean(int ordinal) => ThrowDisposed<bool>();
public override long GetBytes(int ordinal, long dataOffset, byte[] buffer, int bufferOffset, int length) => ThrowDisposed<long>();
public override float GetFloat(int ordinal) => ThrowDisposed<float>();
......@@ -119,14 +114,9 @@ public DbWrappedReader(IDbCommand cmd, DbDataReader reader)
public override bool HasRows => _reader.HasRows;
#if !NETSTANDARD1_3
public override void Close() => _reader.Close();
public override DataTable GetSchemaTable() => _reader.GetSchemaTable();
public override object InitializeLifetimeService() => _reader.InitializeLifetimeService();
#endif
#if NET451
public override System.Runtime.Remoting.ObjRef CreateObjRef(Type requestedType) => _reader.CreateObjRef(requestedType);
#endif
public override int Depth => _reader.Depth;
......@@ -142,9 +132,7 @@ protected override void Dispose(bool disposing)
{
if (disposing)
{
#if !NETSTANDARD1_3
_reader.Close();
#endif
_reader.Dispose();
_reader = DisposedReader.Instance; // all future ops are no-ops
_cmd?.Dispose();
......
<Project>
<PropertyGroup>
<Copyright>2017 Stack Exchange, Inc.</Copyright>
<Copyright>2019 Stack Exchange, Inc.</Copyright>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
......@@ -12,22 +12,19 @@
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/StackExchange/Dapper</RepositoryUrl>
<Deterministic>false</Deterministic>
<DebugSymbols>true</DebugSymbols>
<DebugType>embedded</DebugType>
<DefaultLanguage>en-US</DefaultLanguage>
<IncludeSymbols>false</IncludeSymbols>
<xUnitVersion>2.4.1</xUnitVersion>
</PropertyGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net451'">
<Reference Include="System.Core" Pack="false" />
</ItemGroup>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Nerdbank.GitVersioning" Version="3.0.25" PrivateAssets="all" />
<PackageReference Include="SourceLink.Create.GitHub" Version="2.8.3" PrivateAssets="All" />
<DotNetCliToolReference Include="dotnet-sourcelink" Version="2.8.3" />
<DotNetCliToolReference Include="dotnet-sourcelink-git" Version="2.8.3" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta2-19367-01" PrivateAssets="All"/>
</ItemGroup>
</Project>
\ No newline at end of file
......@@ -7,7 +7,7 @@ skip_commits:
- '**/*.md'
install:
- choco install dotnetcore-sdk --version 3.0.100-preview9-014004
- choco install dotnetcore-sdk --version 3.0.100
environment:
Appveyor: true
......
{
"sdk": {
"version": "3.0.100-preview9"
"version": "3.0.100"
}
}
\ No newline at end of file
1.50.7
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment