Skip to content

Commit 40c2f54

Browse files
author
zzzprojects
committed
Fixed - Remove convert
Fixed - Remove convert
1 parent bd1692d commit 40c2f54

6 files changed

+38
-10
lines changed

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
*.pfx
2+
*.snk
3+
Z.Lab/
4+
15
# Search Cache dump files
26
Cache-*-*-*-*-*
37

src/EntityFramework.DynamicFilters.sln

+11-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio 14
4-
VisualStudioVersion = 14.0.25420.1
3+
# Visual Studio 15
4+
VisualStudioVersion = 15.0.26730.12
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EntityFramework.DynamicFilters", "EntityFramework.DynamicFilters\EntityFramework.DynamicFilters.csproj", "{56E36AD1-E675-42F0-96CB-7F475E05E491}"
77
EndProject
@@ -17,6 +17,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
1717
EndProject
1818
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DynamicFiltersTests", "DynamicFiltersTests\DynamicFiltersTests.csproj", "{F45314CD-2D33-4089-935E-F068ACA59202}"
1919
EndProject
20+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Z.Lab", "Z.Lab\Z.Lab.csproj", "{72DAF92D-633B-44DE-A55C-F6CD10BE15F0}"
21+
EndProject
2022
Global
2123
GlobalSection(SolutionConfigurationPlatforms) = preSolution
2224
Debug|Any CPU = Debug|Any CPU
@@ -35,8 +37,15 @@ Global
3537
{F45314CD-2D33-4089-935E-F068ACA59202}.Debug|Any CPU.Build.0 = Debug|Any CPU
3638
{F45314CD-2D33-4089-935E-F068ACA59202}.Release|Any CPU.ActiveCfg = Release|Any CPU
3739
{F45314CD-2D33-4089-935E-F068ACA59202}.Release|Any CPU.Build.0 = Release|Any CPU
40+
{72DAF92D-633B-44DE-A55C-F6CD10BE15F0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
41+
{72DAF92D-633B-44DE-A55C-F6CD10BE15F0}.Debug|Any CPU.Build.0 = Debug|Any CPU
42+
{72DAF92D-633B-44DE-A55C-F6CD10BE15F0}.Release|Any CPU.ActiveCfg = Release|Any CPU
43+
{72DAF92D-633B-44DE-A55C-F6CD10BE15F0}.Release|Any CPU.Build.0 = Release|Any CPU
3844
EndGlobalSection
3945
GlobalSection(SolutionProperties) = preSolution
4046
HideSolutionNode = FALSE
4147
EndGlobalSection
48+
GlobalSection(ExtensibilityGlobals) = postSolution
49+
SolutionGuid = {60B0E8BB-D7E6-442C-9819-4B9EAB625957}
50+
EndGlobalSection
4251
EndGlobal
Binary file not shown.

src/EntityFramework.DynamicFilters/EntityFramework.DynamicFilters.csproj

+4-4
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@
3535
<SignAssembly>true</SignAssembly>
3636
</PropertyGroup>
3737
<PropertyGroup>
38-
<AssemblyOriginatorKeyFile>DynamicFiltersSigningKey.pfx</AssemblyOriginatorKeyFile>
38+
<AssemblyOriginatorKeyFile>zzzproject.pfx</AssemblyOriginatorKeyFile>
3939
</PropertyGroup>
4040
<ItemGroup>
41-
<Reference Include="EntityFramework">
41+
<Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
4242
<HintPath>..\packages\EntityFramework.6.1.1\lib\net40\EntityFramework.dll</HintPath>
4343
</Reference>
44-
<Reference Include="EntityFramework.SqlServer">
44+
<Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
4545
<HintPath>..\packages\EntityFramework.6.1.1\lib\net40\EntityFramework.SqlServer.dll</HintPath>
4646
</Reference>
4747
<Reference Include="System" />
@@ -70,8 +70,8 @@
7070
</ItemGroup>
7171
<ItemGroup>
7272
<None Include="App.config" />
73-
<None Include="DynamicFiltersSigningKey.pfx" />
7473
<None Include="packages.config" />
74+
<None Include="zzzproject.pfx" />
7575
</ItemGroup>
7676
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
7777
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.

src/EntityFramework.DynamicFilters/LambdaToDbExpressionVisitor.cs

+16-1
Original file line numberDiff line numberDiff line change
@@ -683,7 +683,9 @@ private Expression MapAnyOrAllExpression(MethodCallExpression node)
683683
throw new ApplicationException("Any function call has more than 2 arguments");
684684

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

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

729+
/// <summary>An Expression extension method that removes the convert described by @this.</summary>
730+
/// <param name="this">The @this to act on.</param>
731+
/// <returns>An Expression.</returns>
732+
internal static Expression RemoveConvert(Expression @this)
733+
{
734+
while (@this.NodeType == ExpressionType.Convert || @this.NodeType == ExpressionType.ConvertChecked)
735+
{
736+
@this = ((UnaryExpression)@this).Operand;
737+
}
738+
739+
return @this;
740+
}
741+
727742
private DbConstantExpression CreateConstantExpression(object value)
728743
{
729744
// This is not currently supported (DbExpressionBuilder.Constant throws exceptions). But, DbConstant has

src/EntityFramework.DynamicFilters/Properties/AssemblyInfo.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,6 @@
3232
// You can specify all the values or you can default the Build and Revision Numbers
3333
// by using the '*' as shown below:
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("2.10.0")]
36-
[assembly: AssemblyFileVersion("2.10.0")]
37-
[assembly: AssemblyInformationalVersion("2.10.0")]
35+
[assembly: AssemblyVersion("2.11.0")]
36+
[assembly: AssemblyFileVersion("2.11.0")]
37+
[assembly: AssemblyInformationalVersion("2.11.0")]

0 commit comments

Comments
 (0)