Skip to content
This repository has been archived by the owner on Nov 1, 2018. It is now read-only.

Commit

Permalink
Target .NET Standard 1.4
Browse files Browse the repository at this point in the history
  • Loading branch information
bricelam committed May 19, 2017
1 parent 69bbe22 commit bedb056
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 3 deletions.
1 change: 1 addition & 0 deletions build/dependencies.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<CoreFxVersion>4.4.0-*</CoreFxVersion>
<InternalAspNetCoreSdkVersion>2.1.0-*</InternalAspNetCoreSdkVersion>
<NETFrameworkPackageVersion>2.0.0-*</NETFrameworkPackageVersion>
<NETStandardImplicitPackageVersion>$(BundledNETStandardPackageVersion)</NETStandardImplicitPackageVersion>
<SQLitePCLRawVersion>1.1.5</SQLitePCLRawVersion>
<StyleCopAnalyzersVersion>1.0.0</StyleCopAnalyzersVersion>
<TestSdkVersion>15.3.0-*</TestSdkVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Microsoft.Data.Sqlite.SqliteException
Microsoft.Data.Sqlite.SqliteFactory
Microsoft.Data.Sqlite.SqliteParameter
Microsoft.Data.Sqlite.SqliteTransaction</Description>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFrameworks>netstandard2.0;netstandard1.4</TargetFrameworks>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<CodeAnalysisRuleSet>Microsoft.Data.Sqlite.Core.ruleset</CodeAnalysisRuleSet>
<IncludeSymbols>true</IncludeSymbols>
Expand All @@ -35,6 +35,11 @@ Microsoft.Data.Sqlite.SqliteTransaction</Description>
<PackageReference Include="StyleCop.Analyzers" Version="$(StyleCopAnalyzersVersion)" PrivateAssets="All" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netstandard1.4'">
<PackageReference Include="System.Data.Common" Version="$(CoreFxVersion)" />
<PackageReference Include="System.ValueTuple" Version="$(CoreFxVersion)" />
</ItemGroup>

<ItemGroup>
<Compile Update="Properties\Resources.Designer.cs">
<DesignTime>True</DesignTime>
Expand Down
2 changes: 2 additions & 0 deletions src/Microsoft.Data.Sqlite.Core/SqliteCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,10 @@ public new virtual SqliteDataReader ExecuteReader(CommandBehavior behavior)

raw.sqlite3_reset(stmt);

#if NETSTANDARD2_0
// TODO: Consider having an async path that uses Task.Delay()
Thread.Sleep(150);
#endif
}

SqliteException.ThrowExceptionForRC(rc, Connection.Handle);
Expand Down
7 changes: 6 additions & 1 deletion src/Microsoft.Data.Sqlite.Core/SqliteConnection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,14 @@
using System.Data;
using System.Data.Common;
using System.Diagnostics;
using System.IO;
using Microsoft.Data.Sqlite.Properties;
using Microsoft.Data.Sqlite.Utilities;
using SQLitePCL;

#if NETSTANDARD2_0
using System.IO;
#endif

namespace Microsoft.Data.Sqlite
{
/// <summary>
Expand Down Expand Up @@ -193,6 +196,7 @@ public override void Open()
break;
}

#if NETSTANDARD2_0
var dataDirectory = AppDomain.CurrentDomain.GetData("DataDirectory") as string;
if (!string.IsNullOrEmpty(dataDirectory)
&& (flags & raw.SQLITE_OPEN_URI) == 0
Expand All @@ -201,6 +205,7 @@ public override void Open()
{
filename = Path.Combine(dataDirectory, filename);
}
#endif

var rc = raw.sqlite3_open_v2(filename, out _db, flags, vfs: null);
SqliteException.ThrowExceptionForRC(rc, _db);
Expand Down
2 changes: 2 additions & 0 deletions src/Microsoft.Data.Sqlite.Core/SqliteDataReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,13 @@ public override bool NextResult()
return true;
}

#if NETSTANDARD2_0
/// <summary>
/// Closes the data reader.
/// </summary>
public override void Close()
=> Dispose(true);
#endif

/// <summary>
/// Releases any resources used by the data reader and closes it.
Expand Down
3 changes: 2 additions & 1 deletion src/Microsoft.Data.Sqlite/Microsoft.Data.Sqlite.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ Microsoft.Data.Sqlite.SqliteParameter
Microsoft.Data.Sqlite.SqliteTransaction</Description>
<IncludeBuildOutput>false</IncludeBuildOutput>
<EnableApiCheck>false</EnableApiCheck>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFrameworks>netstandard2.0;netstandard1.4</TargetFrameworks>
<DisableImplicitFrameworkReferences>true</DisableImplicitFrameworkReferences>
</PropertyGroup>

<ItemGroup>
Expand Down

0 comments on commit bedb056

Please sign in to comment.