Skip to content

Commit

Permalink
fix linq2db tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Maxim Voronov committed Jun 5, 2021
1 parent f72f685 commit 31e848e
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion dependencies.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<CSharpVersion>9.0</CSharpVersion>
<EfCoreVersion>5.0.6</EfCoreVersion>
<FrameworkVersion>net48</FrameworkVersion>
<JsonNetVersion>12.0.3</JsonNetVersion>
<JsonNetVersion>13.0.1</JsonNetVersion>
<NetStandardVersion>net5.0</NetStandardVersion>
<NetCoreAppVersion>net5.0</NetCoreAppVersion>
<NetCoreVersion>5.0.0</NetCoreVersion>
Expand Down
2 changes: 1 addition & 1 deletion source/OdataToEntity.Linq2Db/OdataToEntity.Linq2Db.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="linq2db" Version="3.3.0" />
<PackageReference Include="linq2db" Version="3.4.0" />
<PackageReference Include="System.ComponentModel.Annotations" Version="$(ComponentModelAnnotations)" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion source/OdataToEntity/Parsers/OeExpressionBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public Expression ApplySelect(Expression source, OeQueryContext queryContext)
MetadataLevel = queryContext.MetadataLevel,
SkipTokenNameValues = queryContext.SkipTokenNameValues
};
source = selectTranslator.Build(source, ref selectTranslatorParameters, out _entryFactoryFactory);
source = selectTranslator.Build(source, in selectTranslatorParameters, out _entryFactoryFactory);

ChangeParameterType(source);
return source;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public OeSelectTranslator(IEdmModel edmModel, OeJoinBuilder joinBuilder, ODataUr
_rootNavigationItem = new OeNavigationSelectItem(odataUri);
}

public Expression Build(Expression source, ref OeSelectTranslatorParameters parameters, out OeEntryFactoryFactory entryFactoryFactory)
public Expression Build(Expression source, in OeSelectTranslatorParameters parameters, out OeEntryFactoryFactory entryFactoryFactory)
{
entryFactoryFactory = new OeSelectEntryFactoryFactory(_rootNavigationItem);

Expand Down Expand Up @@ -332,7 +332,8 @@ private static Expression SelectStructuralProperties(Expression source, OeNaviga
if (!root.HasNavigationItems())
return source;

ParameterExpression parameter = Expression.Parameter(OeExpressionHelper.GetCollectionItemType(source.Type));
Type itemType = OeExpressionHelper.GetCollectionItemType(source.Type);
ParameterExpression parameter = Expression.Parameter(itemType);
IReadOnlyList<MemberExpression> joins = OeExpressionHelper.GetPropertyExpressions(parameter);
var newJoins = new Expression[joins.Count];

Expand Down Expand Up @@ -369,6 +370,9 @@ private static Expression SelectStructuralProperties(Expression source, OeNaviga
}

NewExpression newSelectorBody = OeExpressionHelper.CreateTupleExpression(newJoins);
if (newSelectorBody.Type == itemType)
return source;

MethodInfo selectMethodInfo = OeMethodInfoHelper.GetSelectMethodInfo(parameter.Type, newSelectorBody.Type);
LambdaExpression newSelector = Expression.Lambda(newSelectorBody, parameter);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="linq2db" Version="3.3.0" />
<PackageReference Include="linq2db.SqlServer" Version="3.3.0" />
<PackageReference Include="linq2db" Version="3.4.0" />
<PackageReference Include="linq2db.SqlServer" Version="3.4.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="$(EfCoreVersion)" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="$(EfCoreVersion)" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(TestSdkVersion)" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="linq2db" Version="3.3.0" />
<PackageReference Include="linq2db" Version="3.4.0" />
<PackageReference Include="System.ComponentModel.Annotations" Version="$(ComponentModelAnnotations)" />
</ItemGroup>

Expand Down

0 comments on commit 31e848e

Please sign in to comment.