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

Target netstandard2.1 #15918

Merged
merged 4 commits into from
Jun 4, 2019
Merged
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
10 changes: 0 additions & 10 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,4 @@
</KnownFrameworkReference>
</ItemGroup>

<!-- This is required to workaround overlap between System.Collections.Generic.IAsyncEnumerable in System.Runtime and System.Interactive.Async. -->
<Target Name="AddAssemblyAliasToReactiveAsync"
AfterTargets="ResolveAssemblyReferences"
Condition=" '$(TargetFramework)' != '' AND ( '$(TargetFramework)' == 'netcoreapp3.0' OR '$(TargetFramework)' == 'netstandard2.1' ) ">
<ItemGroup>
<ReferencePath Condition=" '%(FileName)' == 'System.Interactive.Async' ">
<Aliases>reactive</Aliases>
</ReferencePath>
</ItemGroup>
</Target>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

<PropertyGroup>
<TargetFrameworks>net461;netcoreapp2.0;netcoreapp2.1;netcoreapp2.2;netcoreapp3.0</TargetFrameworks>
<TargetFrameworks Condition=" '$(Configuration)' == 'Release' Or '$(Configuration)' == 'Debug' ">netcoreapp3.0</TargetFrameworks>
<RootNamespace>Microsoft.EntityFrameworkCore.Benchmarks</RootNamespace>
<OutputType>Exe</OutputType>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

<PropertyGroup>
<TargetFrameworks>net461;netcoreapp2.0;netcoreapp2.1;netcoreapp2.2;netcoreapp3.0</TargetFrameworks>
<TargetFrameworks Condition=" '$(Configuration)' == 'Release' Or '$(Configuration)' == 'Debug' ">netcoreapp3.0</TargetFrameworks>
<RootNamespace>Microsoft.EntityFrameworkCore.Benchmarks</RootNamespace>
<OutputType>Exe</OutputType>
</PropertyGroup>
Expand Down
1 change: 0 additions & 1 deletion eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
<SQLitePCLRawBundleSqlcipherPackageVersion>1.1.12</SQLitePCLRawBundleSqlcipherPackageVersion>
<SQLitePCLRawCorePackageVersion>1.1.12</SQLitePCLRawCorePackageVersion>
<StyleCopAnalyzersPackageVersion>1.1.1-beta.61</StyleCopAnalyzersPackageVersion>
<SystemInteractiveAsyncPackageVersion>3.2.0</SystemInteractiveAsyncPackageVersion>
<BenchmarkDotNetPackageVersion>0.11.3</BenchmarkDotNetPackageVersion>
<MicrosoftDataSqlClientPackageVersion>1.0.19128.1-Preview</MicrosoftDataSqlClientPackageVersion>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/EFCore.Abstractions/EFCore.Abstractions.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<Description>Provides abstractions and attributes that are used to configure Entity Framework Core</Description>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFramework>netstandard2.1</TargetFramework>
<MinClientVersion>3.6</MinClientVersion>
<AssemblyName>Microsoft.EntityFrameworkCore.Abstractions</AssemblyName>
<RootNamespace>Microsoft.EntityFrameworkCore</RootNamespace>
Expand Down
2 changes: 1 addition & 1 deletion src/EFCore.Cosmos/EFCore.Cosmos.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<Description>Azure Cosmos provider for Entity Framework Core.</Description>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFramework>netstandard2.1</TargetFramework>
<MinClientVersion>3.6</MinClientVersion>
<AssemblyName>Microsoft.EntityFrameworkCore.Cosmos</AssemblyName>
<RootNamespace>Microsoft.EntityFrameworkCore.Cosmos</RootNamespace>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public DocumentQueryExpression(bool async, string collectionId, SelectExpression
public override Expression Reduce()
=> Call(
_async ? _queryAsyncMethodInfo : _queryMethodInfo,
QueryCompilationContext2.QueryContextParameter,
QueryCompilationContext.QueryContextParameter,
Constant(_collectionId),
Constant(SelectExpression));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,23 +82,28 @@ public AsyncShaperEnumerable(
_shaper = shaper;
}

public IAsyncEnumerator<T> GetEnumerator() => new AsyncShaperEnumerator(this);
public IAsyncEnumerator<T> GetAsyncEnumerator(CancellationToken cancellationToken = default)
{
return new AsyncShaperEnumerator(this, cancellationToken);
}

private class AsyncShaperEnumerator : IAsyncEnumerator<T>
{
private readonly IAsyncEnumerator<JObject> _enumerator;
private readonly Func<JObject, T> _shaper;

public AsyncShaperEnumerator(AsyncShaperEnumerable<T> enumerable)
public AsyncShaperEnumerator(AsyncShaperEnumerable<T> enumerable, CancellationToken cancellationToken)
{
_enumerator = enumerable._innerEnumerable.GetEnumerator();
_enumerator = enumerable._innerEnumerable.GetAsyncEnumerator(cancellationToken);
_shaper = enumerable._shaper;
}

public T Current { get; private set; }

[MethodImpl(MethodImplOptions.AggressiveInlining)]
public async Task<bool> MoveNext(CancellationToken cancellationToken)
public async ValueTask<bool> MoveNextAsync()
{
if (!await _enumerator.MoveNext(cancellationToken))
if (!await _enumerator.MoveNextAsync())
{
Current = default;
return false;
Expand All @@ -108,9 +113,12 @@ public async Task<bool> MoveNext(CancellationToken cancellationToken)
return true;
}

public T Current { get; private set; }
public ValueTask DisposeAsync()
{
_enumerator.DisposeAsync();

public void Dispose() => _enumerator.Dispose();
return default;
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/EFCore.Cosmos/Query/Internal/EntityShaper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public virtual LambdaExpression CreateShaperLambda()
Expression.Call(
_shapeMethodInfo,
jObjectParameter,
QueryCompilationContext2.QueryContextParameter,
QueryCompilationContext.QueryContextParameter,
Expression.Constant(_trackingQuery),
entityInfo),
_entityType.ClrType),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public CosmosEntityQueryableTranslatorFactory(IModel model)
_model = model;
}

public override EntityQueryableTranslator Create(QueryCompilationContext2 queryCompilationContext)
public override EntityQueryableTranslator Create(QueryCompilationContext queryCompilationContext)
{
throw new NotImplementedException();
}
Expand All @@ -39,7 +39,7 @@ public CosmosShapedQueryCompilingExpressionVisitorFactory(IEntityMaterializerSou
_entityMaterializerSource = entityMaterializerSource;
}

public ShapedQueryCompilingExpressionVisitor Create(QueryCompilationContext2 queryCompilationContext)
public ShapedQueryCompilingExpressionVisitor Create(QueryCompilationContext queryCompilationContext)
{
throw new NotImplementedException();
//return new CosmosShapedQueryCompilingExpressionVisitor(
Expand Down
23 changes: 13 additions & 10 deletions src/EFCore.Cosmos/Storage/Internal/CosmosClientWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -428,8 +428,8 @@ public DocumentAsyncEnumerable(
_cosmosSqlQuery = cosmosSqlQuery;
}

public IAsyncEnumerator<JObject> GetEnumerator() => new AsyncEnumerator(this);

public IAsyncEnumerator<JObject> GetAsyncEnumerator(CancellationToken cancellationToken = default)
=> new AsyncEnumerator(this, cancellationToken);
private class AsyncEnumerator : IAsyncEnumerator<JObject>
{
private CosmosResultSetIterator _query;
Expand All @@ -439,20 +439,23 @@ private class AsyncEnumerator : IAsyncEnumerator<JObject>
private readonly CosmosClientWrapper _cosmosClient;
private readonly string _containerId;
private readonly CosmosSqlQuery _cosmosSqlQuery;
private readonly CancellationToken _cancellationToken;

public AsyncEnumerator(DocumentAsyncEnumerable documentEnumerable)
public AsyncEnumerator(DocumentAsyncEnumerable documentEnumerable, CancellationToken cancellationToken)
{
_cosmosClient = documentEnumerable._cosmosClient;
_containerId = documentEnumerable._containerId;
_cosmosSqlQuery = documentEnumerable._cosmosSqlQuery;
_cancellationToken = cancellationToken;
}

public JObject Current { get; private set; }


[MethodImpl(MethodImplOptions.AggressiveInlining)]
public async Task<bool> MoveNext(CancellationToken cancellationToken)
public async ValueTask<bool> MoveNextAsync()
{
cancellationToken.ThrowIfCancellationRequested();
_cancellationToken.ThrowIfCancellationRequested();

if (_jsonReader == null)
{
Expand All @@ -467,7 +470,7 @@ public async Task<bool> MoveNext(CancellationToken cancellationToken)
return false;
}

_responseStream = (await _query.FetchNextSetAsync(cancellationToken)).Content;
_responseStream = (await _query.FetchNextSetAsync(_cancellationToken)).Content;
_reader = new StreamReader(_responseStream);
_jsonReader = new JsonTextReader(_reader);

Expand Down Expand Up @@ -510,20 +513,20 @@ public async Task<bool> MoveNext(CancellationToken cancellationToken)
_reader = null;
_responseStream.Dispose();
_responseStream = null;
return await MoveNext(cancellationToken);
return await MoveNextAsync();
}

public void Dispose()
public ValueTask DisposeAsync()
{
_jsonReader?.Close();
_jsonReader = null;
_reader?.Dispose();
_reader = null;
_responseStream?.Dispose();
_responseStream = null;
}

public void Reset() => throw new NotImplementedException();
return default;
}
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/EFCore.Design/EFCore.Design.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<Description>Shared design-time components for Entity Framework Core tools.</Description>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFramework>netstandard2.1</TargetFramework>
<AssemblyName>Microsoft.EntityFrameworkCore.Design</AssemblyName>
<RootNamespace>Microsoft.EntityFrameworkCore</RootNamespace>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
Expand All @@ -20,7 +20,7 @@
<PackagePath>build</PackagePath>
</None>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\EFCore.Relational\EFCore.Relational.csproj" PrivateAssets="contentfiles;build" />
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/EFCore.InMemory/EFCore.InMemory.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<Description>In-memory database provider for Entity Framework Core (to be used for testing purposes).</Description>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFramework>netstandard2.1</TargetFramework>
<MinClientVersion>3.6</MinClientVersion>
<AssemblyName>Microsoft.EntityFrameworkCore.InMemory</AssemblyName>
<RootNamespace>Microsoft.EntityFrameworkCore.InMemory</RootNamespace>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@

namespace Microsoft.EntityFrameworkCore.InMemory.Query.Pipeline
{
public class InMemoryEntityQueryableExpressionVisitor2 : EntityQueryableExpressionVisitor2
public class InMemoryEntityQueryableExpressionVisitor : EntityQueryableExpressionVisitor
{
private readonly IModel _model;

public InMemoryEntityQueryableExpressionVisitor2(IModel model)
public InMemoryEntityQueryableExpressionVisitor(IModel model)
{
_model = model;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public InMemoryEntityQueryableTranslatorFactory(IModel model)
_model = model;
}

public override EntityQueryableTranslator Create(QueryCompilationContext2 queryCompilationContext)
public override EntityQueryableTranslator Create(QueryCompilationContext queryCompilationContext)
{
return new InMemoryEntityQueryableTranslator(_model);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public InMemoryEntityQueryableTranslator(IModel model)

public override Expression Visit(Expression query)
{
return new InMemoryEntityQueryableExpressionVisitor2(_model).Visit(query);
return new InMemoryEntityQueryableExpressionVisitor(_model).Visit(query);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ protected override Expression VisitExtension(Expression extensionExpression)
case InMemoryTableExpression inMemoryTableExpression:
return Expression.Call(
_queryMethodInfo,
QueryCompilationContext2.QueryContextParameter,
QueryCompilationContext.QueryContextParameter,
Expression.Constant(inMemoryTableExpression.EntityType));
}

Expand All @@ -74,15 +74,15 @@ protected override Expression VisitShapedQueryExpression(ShapedQueryExpression s

var shaperLambda = Expression.Lambda(
newBody,
QueryCompilationContext2.QueryContextParameter,
QueryCompilationContext.QueryContextParameter,
enumeratorParameter);

return Expression.Call(
Async
? _shapeAsyncMethodInfo.MakeGenericMethod(shaperLambda.ReturnType.GetGenericArguments().Single())
: _shapeMethodInfo.MakeGenericMethod(shaperLambda.ReturnType),
innerEnumerable,
QueryCompilationContext2.QueryContextParameter,
QueryCompilationContext.QueryContextParameter,
Expression.Constant(shaperLambda.Compile()),
Expression.Constant(_contextType),
Expression.Constant(_logger));
Expand Down Expand Up @@ -232,7 +232,8 @@ public AsyncQueryingEnumerable(
_logger = logger;
}

public IAsyncEnumerator<T> GetEnumerator() => new AsyncEnumerator(this);
public IAsyncEnumerator<T> GetAsyncEnumerator(CancellationToken cancellationToken = default)
=> new AsyncEnumerator(this, cancellationToken);

private sealed class AsyncEnumerator : IAsyncEnumerator<T>
{
Expand All @@ -242,21 +243,23 @@ private sealed class AsyncEnumerator : IAsyncEnumerator<T>
private readonly Func<QueryContext, IEnumerator<ValueBuffer>, Task<T>> _shaper;
private readonly Type _contextType;
private readonly IDiagnosticsLogger<DbLoggerCategory.Query> _logger;
private readonly CancellationToken _cancellationToken;

public AsyncEnumerator(AsyncQueryingEnumerable<T> asyncQueryingEnumerable)
public AsyncEnumerator(
AsyncQueryingEnumerable<T> asyncQueryingEnumerable,
CancellationToken cancellationToken)
{
_queryContext = asyncQueryingEnumerable._queryContext;
_innerEnumerable = asyncQueryingEnumerable._innerEnumerable;
_shaper = asyncQueryingEnumerable._shaper;
_contextType = asyncQueryingEnumerable._contextType;
_logger = asyncQueryingEnumerable._logger;
_cancellationToken = cancellationToken;
}

public T Current { get; private set; }

public void Dispose() => _enumerator?.Dispose();

public async Task<bool> MoveNext(CancellationToken cancellationToken)
public async ValueTask<bool> MoveNextAsync()
{
try
{
Expand All @@ -280,6 +283,13 @@ public async Task<bool> MoveNext(CancellationToken cancellationToken)
throw;
}
}

public ValueTask DisposeAsync()
{
_enumerator?.Dispose();

return default;
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public InMemoryShapedQueryCompilingExpressionVisitorFactory(IEntityMaterializerS
_entityMaterializerSource = entityMaterializerSource;
}

public ShapedQueryCompilingExpressionVisitor Create(QueryCompilationContext2 queryCompilationContext)
public ShapedQueryCompilingExpressionVisitor Create(QueryCompilationContext queryCompilationContext)
{
return new InMemoryShapedQueryCompilingExpressionVisitor(
_entityMaterializerSource,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace Microsoft.EntityFrameworkCore.InMemory.Query.Pipeline
{
public class InMemoryShapedQueryOptimizerFactory : ShapedQueryOptimizerFactory
{
public override ShapedQueryOptimizer Create(QueryCompilationContext2 queryCompilationContext)
public override ShapedQueryOptimizer Create(QueryCompilationContext queryCompilationContext)
{
return new InMemoryShapedQueryOptimizer();
}
Expand Down
2 changes: 1 addition & 1 deletion src/EFCore.InMemory/Query/Pipeline/Translator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ protected override Expression VisitParameter(ParameterExpression parameterExpres
{
return Expression.Call(
_getParameterValueMethodInfo.MakeGenericMethod(parameterExpression.Type),
QueryCompilationContext2.QueryContextParameter,
QueryCompilationContext.QueryContextParameter,
Expression.Constant(parameterExpression.Name));
}

Expand Down
2 changes: 1 addition & 1 deletion src/EFCore.Proxies/EFCore.Proxies.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<Description>Lazy-loading proxies for EF Core.</Description>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFramework>netstandard2.1</TargetFramework>
<MinClientVersion>3.6</MinClientVersion>
<AssemblyName>Microsoft.EntityFrameworkCore.Proxies</AssemblyName>
<RootNamespace>Microsoft.EntityFrameworkCore</RootNamespace>
Expand Down
2 changes: 1 addition & 1 deletion src/EFCore.Relational/EFCore.Relational.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<Description>Shared Entity Framework Core components for relational database providers.</Description>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFramework>netstandard2.1</TargetFramework>
<MinClientVersion>3.6</MinClientVersion>
<AssemblyName>Microsoft.EntityFrameworkCore.Relational</AssemblyName>
<RootNamespace>Microsoft.EntityFrameworkCore</RootNamespace>
Expand Down
Loading