Skip to content

Commit

Permalink
Fixed - Remove convert
Browse files Browse the repository at this point in the history
Fixed - Remove convert
  • Loading branch information
zzzprojects committed Sep 18, 2017
1 parent bd1692d commit 40c2f54
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 10 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
*.pfx
*.snk
Z.Lab/

# Search Cache dump files
Cache-*-*-*-*-*

Expand Down
13 changes: 11 additions & 2 deletions src/EntityFramework.DynamicFilters.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
# Visual Studio 15
VisualStudioVersion = 15.0.26730.12
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EntityFramework.DynamicFilters", "EntityFramework.DynamicFilters\EntityFramework.DynamicFilters.csproj", "{56E36AD1-E675-42F0-96CB-7F475E05E491}"
EndProject
Expand All @@ -17,6 +17,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DynamicFiltersTests", "DynamicFiltersTests\DynamicFiltersTests.csproj", "{F45314CD-2D33-4089-935E-F068ACA59202}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Z.Lab", "Z.Lab\Z.Lab.csproj", "{72DAF92D-633B-44DE-A55C-F6CD10BE15F0}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -35,8 +37,15 @@ Global
{F45314CD-2D33-4089-935E-F068ACA59202}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F45314CD-2D33-4089-935E-F068ACA59202}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F45314CD-2D33-4089-935E-F068ACA59202}.Release|Any CPU.Build.0 = Release|Any CPU
{72DAF92D-633B-44DE-A55C-F6CD10BE15F0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{72DAF92D-633B-44DE-A55C-F6CD10BE15F0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{72DAF92D-633B-44DE-A55C-F6CD10BE15F0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{72DAF92D-633B-44DE-A55C-F6CD10BE15F0}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {60B0E8BB-D7E6-442C-9819-4B9EAB625957}
EndGlobalSection
EndGlobal
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@
<SignAssembly>true</SignAssembly>
</PropertyGroup>
<PropertyGroup>
<AssemblyOriginatorKeyFile>DynamicFiltersSigningKey.pfx</AssemblyOriginatorKeyFile>
<AssemblyOriginatorKeyFile>zzzproject.pfx</AssemblyOriginatorKeyFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="EntityFramework">
<Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<HintPath>..\packages\EntityFramework.6.1.1\lib\net40\EntityFramework.dll</HintPath>
</Reference>
<Reference Include="EntityFramework.SqlServer">
<Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<HintPath>..\packages\EntityFramework.6.1.1\lib\net40\EntityFramework.SqlServer.dll</HintPath>
</Reference>
<Reference Include="System" />
Expand Down Expand Up @@ -70,8 +70,8 @@
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="DynamicFiltersSigningKey.pfx" />
<None Include="packages.config" />
<None Include="zzzproject.pfx" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,9 @@ private Expression MapAnyOrAllExpression(MethodCallExpression node)
throw new ApplicationException("Any function call has more than 2 arguments");

// Visit the first argument so that we can get the DbPropertyExpression which is the source of the method call.
var sourceExpression = Visit(node.Arguments[0]);
var argument = node.Arguments[0];
argument = RemoveConvert(argument);
var sourceExpression = Visit(argument);
var collectionExpression = GetDbExpressionForExpression(sourceExpression);

// Visit this DbExpression using the QueryVisitor in case it has it's own filters that need to be applied.
Expand Down Expand Up @@ -724,6 +726,19 @@ private Expression MapAnyOrAllExpression(MethodCallExpression node)
return node;
}

/// <summary>An Expression extension method that removes the convert described by @this.</summary>
/// <param name="this">The @this to act on.</param>
/// <returns>An Expression.</returns>
internal static Expression RemoveConvert(Expression @this)
{
while (@this.NodeType == ExpressionType.Convert || @this.NodeType == ExpressionType.ConvertChecked)
{
@this = ((UnaryExpression)@this).Operand;
}

return @this;
}

private DbConstantExpression CreateConstantExpression(object value)
{
// This is not currently supported (DbExpressionBuilder.Constant throws exceptions). But, DbConstant has
Expand Down
6 changes: 3 additions & 3 deletions src/EntityFramework.DynamicFilters/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.10.0")]
[assembly: AssemblyFileVersion("2.10.0")]
[assembly: AssemblyInformationalVersion("2.10.0")]
[assembly: AssemblyVersion("2.11.0")]
[assembly: AssemblyFileVersion("2.11.0")]
[assembly: AssemblyInformationalVersion("2.11.0")]

0 comments on commit 40c2f54

Please sign in to comment.