Skip to content

Commit

Permalink
Merge pull request #55 from linq2db/master
Browse files Browse the repository at this point in the history
Release 3.4.0
  • Loading branch information
sdanyliv authored Jul 10, 2020
2 parents b2497fd + a95a960 commit dc499f1
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 50 deletions.
2 changes: 1 addition & 1 deletion Build/linq2db.Default.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<Version>3.3.0</Version>
<Version>3.4.0</Version>

<Description>Allows to execute Linq to DB (linq2db) queries in Entity Framework Core DbContext.</Description>
<Title>Linq to DB (linq2db) extensions for Entity Framework Core</Title>
Expand Down
2 changes: 1 addition & 1 deletion NuGet/linq2db.EntityFrameworkCore.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<dependencies>
<group targetFramework=".NETStandard2.0">
<dependency id="Microsoft.EntityFrameworkCore.Relational" version="3.1.3" />
<dependency id="linq2db" version="3.0.0-rc.1" />
<dependency id="linq2db" version="3.0.0" />
</group>
</dependencies>
</metadata>
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@ Below is a list of providers, that should work right now:
# Know limitations
- No Lazy loading
- No way to work with in-memory database
- `HasConversion` for properties currently not supported. Can be done via linq2db's `MappingSchema.Default.SetConverter()` function.

# Help! It doesn't work!

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public EFCoreExpressionAttribute(string expression) : base(expression)
}

public override ISqlExpression GetExpression(IDataContext dataContext, SelectQuery query,
Expression expression, Func<Expression, ISqlExpression> converter)
Expression expression, Func<Expression, ColumnDescriptor?, ISqlExpression> converter)
{
var knownExpressions = new List<Expression>();
if (expression.NodeType == ExpressionType.Call)
Expand All @@ -38,7 +38,7 @@ public override ISqlExpression GetExpression(IDataContext dataContext, SelectQue
var idx = int.Parse(v);

if (pams[idx] == null)
pams[idx] = converter(knownExpressions[idx]);
pams[idx] = converter(knownExpressions[idx], null);

return v;
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ TResult IAsyncQueryProvider.ExecuteAsync<TResult>(Expression expression, Cancell

public System.Collections.Generic.IAsyncEnumerable<TResult> ExecuteAsync<TResult>(Expression expression)
{
return new AsyncEnumerableAdapter<TResult>(QueryProvider.ExecuteAsync<TResult>(expression));
return QueryProvider.ExecuteAsync<TResult>(expression);
}

IAsyncEnumerable<TResult> IQueryProviderAsync.ExecuteAsync<TResult>(Expression expression)
Expand Down Expand Up @@ -104,45 +104,5 @@ System.Collections.Generic.IAsyncEnumerator<T> System.Collections.Generic.IAsync
return ExecuteAsync<T>(Expression).GetAsyncEnumerator(cancellationToken);
}

class AsyncEnumerableAdapter<TEntity> : System.Collections.Generic.IAsyncEnumerable<TEntity>
{
private IAsyncEnumerable<TEntity> AsyncEnumerable { get; }

public AsyncEnumerableAdapter(IAsyncEnumerable<TEntity> asyncEnumerable)
{
AsyncEnumerable = asyncEnumerable;
}

public System.Collections.Generic.IAsyncEnumerator<TEntity> GetAsyncEnumerator(CancellationToken cancellationToken = default)
{
return new AsyncEnumeratorAdapter<TEntity>(AsyncEnumerable.GetEnumerator(), cancellationToken);
}
}

class AsyncEnumeratorAdapter<TEntity> : System.Collections.Generic.IAsyncEnumerator<TEntity>
{
private readonly CancellationToken _cancellationToken;
private IAsyncEnumerator<TEntity> AsyncEnumerator { get; }

public AsyncEnumeratorAdapter(IAsyncEnumerator<TEntity> asyncEnumerator, CancellationToken cancellationToken)
{
_cancellationToken = cancellationToken;
AsyncEnumerator = asyncEnumerator;
}

public ValueTask<bool> MoveNextAsync()
{
return new ValueTask<bool>(AsyncEnumerator.MoveNext(_cancellationToken));
}

public TEntity Current => AsyncEnumerator.Current;

public ValueTask DisposeAsync()
{
AsyncEnumerator?.Dispose();
return default;
}
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ namespace LinqToDB.EntityFrameworkCore
/// </summary>
public class LinqToDBExtensionsAdapter : IExtensionsAdapter
{
public IAsyncEnumerable<TSource> AsAsyncEnumerable<TSource>(IQueryable<TSource> source)
=> EntityFrameworkQueryableExtensions.AsAsyncEnumerable(source);

public Task ForEachAsync<TSource>(
IQueryable<TSource> source,
Action<TSource> action,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="linq2db" Version="3.0.0-rc.1" />
<PackageReference Include="linq2db" Version="3.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="3.1.3" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,7 @@ public async Task TestIncludeString([Values(true, false)] bool enableFilter)
var result = await query.ToLinqToDB().ToArrayAsync();
}
}

[Test]
public async Task TestLoadFilter([Values(true, false)] bool enableFilter)
{
Expand All @@ -499,7 +500,6 @@ public async Task TestLoadFilter([Values(true, false)] bool enableFilter)
}
}


[Test]
public async Task TestGetTable([Values(true, false)] bool enableFilter)
{
Expand Down
4 changes: 2 additions & 2 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
variables:
solution: 'linq2db.EFCore.sln'
build_configuration: 'Release'
assemblyVersion: 3.3.0
nugetVersion: 3.3.0
assemblyVersion: 3.4.0
nugetVersion: 3.4.0
artifact_nugets: 'nugets'

# build on commits to important branches (master + release branches):
Expand Down

0 comments on commit dc499f1

Please sign in to comment.