Skip to content

Commit c7549aa

Browse files
Add EF Classic version
1 parent 7edb8a2 commit c7549aa

File tree

9 files changed

+270
-1
lines changed

9 files changed

+270
-1
lines changed

src/EntityFramework.DynamicFilters.sln

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,22 @@ Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "DynamicFiltersTests.Shared"
2525
EndProject
2626
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DynamicFiltersTests.NetStandard21", "DynamicFiltersTests.NetStandard21\DynamicFiltersTests.NetStandard21.csproj", "{89FAD78B-B06F-4A31-B9C0-E521803EE0E8}"
2727
EndProject
28-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EntityFramework.DynamicFilters.Core.Lab", "EntityFramework.DynamicFilters.Lab\EntityFramework.DynamicFilters.Core.Lab.csproj", "{A55AE109-B6AD-46AC-8275-4A529A130ED9}"
28+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EntityFramework.DynamicFilters.Core.Lab", "EntityFramework.DynamicFilters.Lab\EntityFramework.DynamicFilters.Core.Lab.csproj", "{A55AE109-B6AD-46AC-8275-4A529A130ED9}"
29+
EndProject
30+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Z.EntityFramework.Classic.DynamicFilters.Net40", "Z.EntityFramework.Classic.DynamicFilters.Net40\Z.EntityFramework.Classic.DynamicFilters.Net40.csproj", "{9014BFDD-8311-404A-8B3D-846A7C4D32C7}"
31+
EndProject
32+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Z.EntityFramework.Classic.DynamicFilters.NetStandard20", "Z.EntityFramework.Classic.DynamicFilters.NetStandard20\Z.EntityFramework.Classic.DynamicFilters.NetStandard20.csproj", "{24EBE85E-02C4-4FAE-B7E9-A4EA3C5FDE50}"
33+
EndProject
34+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Z.EntityFramework.Classic.DynamicFilters.Core.Lab", "Z.EntityFramework.Classic.DynamicFilters.Core.Lab\Z.EntityFramework.Classic.DynamicFilters.Core.Lab.csproj", "{6E1968E9-2BEE-4AF2-BDBD-6EC51000FB32}"
2935
EndProject
3036
Global
3137
GlobalSection(SharedMSBuildProjectFiles) = preSolution
3238
EntityFramework.DynamicFilters.Shared\EntityFramework.DynamicFilters.Shared.projitems*{13d421cd-5dc4-4287-b1b2-110a9cb5e07f}*SharedItemsImports = 13
39+
EntityFramework.DynamicFilters.Shared\EntityFramework.DynamicFilters.Shared.projitems*{24ebe85e-02c4-4fae-b7e9-a4ea3c5fde50}*SharedItemsImports = 5
3340
EntityFramework.DynamicFilters.Shared\EntityFramework.DynamicFilters.Shared.projitems*{56e36ad1-e675-42f0-96cb-7f475e05e491}*SharedItemsImports = 4
3441
DynamicFiltersTests.Shared\DynamicFiltersTests.Shared.projitems*{5f88787d-e19d-4d4e-a54c-e1acf3729a96}*SharedItemsImports = 13
3542
DynamicFiltersTests.Shared\DynamicFiltersTests.Shared.projitems*{89fad78b-b06f-4a31-b9c0-e521803ee0e8}*SharedItemsImports = 5
43+
EntityFramework.DynamicFilters.Shared\EntityFramework.DynamicFilters.Shared.projitems*{9014bfdd-8311-404a-8b3d-846a7c4d32c7}*SharedItemsImports = 4
3644
EntityFramework.DynamicFilters.Shared\EntityFramework.DynamicFilters.Shared.projitems*{e83d9d17-04e8-4ed8-b0e5-135324ddd673}*SharedItemsImports = 5
3745
DynamicFiltersTests.Shared\DynamicFiltersTests.Shared.projitems*{f45314cd-2d33-4089-935e-f068aca59202}*SharedItemsImports = 4
3846
EndGlobalSection
@@ -65,6 +73,18 @@ Global
6573
{A55AE109-B6AD-46AC-8275-4A529A130ED9}.Debug|Any CPU.Build.0 = Debug|Any CPU
6674
{A55AE109-B6AD-46AC-8275-4A529A130ED9}.Release|Any CPU.ActiveCfg = Release|Any CPU
6775
{A55AE109-B6AD-46AC-8275-4A529A130ED9}.Release|Any CPU.Build.0 = Release|Any CPU
76+
{9014BFDD-8311-404A-8B3D-846A7C4D32C7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
77+
{9014BFDD-8311-404A-8B3D-846A7C4D32C7}.Debug|Any CPU.Build.0 = Debug|Any CPU
78+
{9014BFDD-8311-404A-8B3D-846A7C4D32C7}.Release|Any CPU.ActiveCfg = Release|Any CPU
79+
{9014BFDD-8311-404A-8B3D-846A7C4D32C7}.Release|Any CPU.Build.0 = Release|Any CPU
80+
{24EBE85E-02C4-4FAE-B7E9-A4EA3C5FDE50}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
81+
{24EBE85E-02C4-4FAE-B7E9-A4EA3C5FDE50}.Debug|Any CPU.Build.0 = Debug|Any CPU
82+
{24EBE85E-02C4-4FAE-B7E9-A4EA3C5FDE50}.Release|Any CPU.ActiveCfg = Release|Any CPU
83+
{24EBE85E-02C4-4FAE-B7E9-A4EA3C5FDE50}.Release|Any CPU.Build.0 = Release|Any CPU
84+
{6E1968E9-2BEE-4AF2-BDBD-6EC51000FB32}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
85+
{6E1968E9-2BEE-4AF2-BDBD-6EC51000FB32}.Debug|Any CPU.Build.0 = Debug|Any CPU
86+
{6E1968E9-2BEE-4AF2-BDBD-6EC51000FB32}.Release|Any CPU.ActiveCfg = Release|Any CPU
87+
{6E1968E9-2BEE-4AF2-BDBD-6EC51000FB32}.Release|Any CPU.Build.0 = Release|Any CPU
6888
EndGlobalSection
6989
GlobalSection(SolutionProperties) = preSolution
7090
HideSolutionNode = FALSE
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
using System;
2+
3+
namespace Z.EntityFramework.Classic.DynamicFilters.Core.Lab
4+
{
5+
class Program
6+
{
7+
static void Main(string[] args)
8+
{
9+
Request_Substring.Execute();
10+
}
11+
}
12+
}
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Data.Entity;
4+
using System.Linq;
5+
using System.Text;
6+
using EntityFramework.DynamicFilters;
7+
8+
namespace Z.EntityFramework.Classic.DynamicFilters.Core.Lab
9+
{
10+
class Request_Substring
11+
{
12+
public static void Execute()
13+
{ // ADD seed data here
14+
using (var context = new EntityContext())
15+
{
16+
context.Database.Delete();
17+
context.Database.Create();
18+
context.Customers.Add(new Customer() { Name = "Customer_A", IsActive = false, Code = "00001.00003.00004" });
19+
context.Customers.Add(new Customer() { Name = "Customer_B", IsActive = true, Code = "00002.00003.00004" });
20+
context.Customers.Add(new Customer() { Name = "Customer_C", IsActive = false, Code = "00003.00003.00004" });
21+
context.SaveChanges();
22+
23+
}
24+
25+
// ADD code to reproduce the issue here (Add filter in the context if required)
26+
using (var context = new EntityContext())
27+
{
28+
// issue
29+
}
30+
31+
using (var context = new EntityContext())
32+
{
33+
var test = context.Customers.ToList();
34+
}
35+
}
36+
public class EntityContext : DbContext
37+
{
38+
public static string DatabaseName = "EFDynamicFiltersLab";
39+
// [REPLACE] is in Beta.
40+
public static string ConnectionString =
41+
("Server=[REPLACE];Initial Catalog = [BD]; Integrated Security = true; Connection Timeout = 35; Persist Security Info=True").Replace("[REPLACE]", Environment.MachineName).Replace("[BD]", DatabaseName);
42+
43+
public EntityContext() : base(ConnectionString)
44+
{
45+
46+
}
47+
48+
public DbSet<Customer> Customers { get; set; }
49+
50+
// ADD code to reproduce the issue here
51+
protected override void OnModelCreating(DbModelBuilder modelBuilder)
52+
{
53+
// Example
54+
modelBuilder.Filter("CodeFilter", (Customer d,List<string> AllowedProjectCodes) =>
55+
AllowedProjectCodes.Contains(d.Code.Substring(0, 5)) ,
56+
()=>LoadParentCodesFromPrincipal()
57+
);
58+
59+
}
60+
61+
private List<string> LoadParentCodesFromPrincipal()
62+
{
63+
return new List<string>() { "00001", "00005" };
64+
}
65+
}
66+
67+
68+
public class Customer
69+
{
70+
public int CustomerID { get; set; }
71+
public string Name { get; set; }
72+
public Boolean IsActive { get; set; }
73+
public string Code { get; set; }
74+
}
75+
}
76+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net5.0</TargetFramework>
6+
</PropertyGroup>
7+
8+
<ItemGroup>
9+
<ProjectReference Include="..\Z.EntityFramework.Classic.DynamicFilters.NetStandard20\Z.EntityFramework.Classic.DynamicFilters.NetStandard20.csproj" />
10+
</ItemGroup>
11+
12+
</Project>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<configuration>
3+
<configSections>
4+
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
5+
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, Z.EntityFramework.Classic, Version=7.0.0.0, Culture=neutral, PublicKeyToken=afc61983f100d280" requirePermission="false" />
6+
</configSections>
7+
<entityFramework>
8+
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, Z.EntityFramework.Classic" />
9+
<providers>
10+
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, Z.EntityFramework.Classic.SqlServer" />
11+
</providers>
12+
</entityFramework>
13+
</configuration>
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
using System.Reflection;
2+
using System.Runtime.CompilerServices;
3+
using System.Runtime.InteropServices;
4+
5+
// General Information about an assembly is controlled through the following
6+
// set of attributes. Change these attribute values to modify the information
7+
// associated with an assembly.
8+
[assembly: AssemblyTitle("Z.EntityFramework.Classic.DynamicFilters.Net40")]
9+
[assembly: AssemblyDescription("")]
10+
[assembly: AssemblyConfiguration("")]
11+
[assembly: AssemblyCompany("")]
12+
[assembly: AssemblyProduct("Z.EntityFramework.Classic.DynamicFilters.Net40")]
13+
[assembly: AssemblyCopyright("Copyright © 2021")]
14+
[assembly: AssemblyTrademark("")]
15+
[assembly: AssemblyCulture("")]
16+
17+
// Setting ComVisible to false makes the types in this assembly not visible
18+
// to COM components. If you need to access a type in this assembly from
19+
// COM, set the ComVisible attribute to true on that type.
20+
[assembly: ComVisible(false)]
21+
22+
// The following GUID is for the ID of the typelib if this project is exposed to COM
23+
[assembly: Guid("9014bfdd-8311-404a-8b3d-846a7c4d32c7")]
24+
25+
// Version information for an assembly consists of the following four values:
26+
//
27+
// Major Version
28+
// Minor Version
29+
// Build Number
30+
// Revision
31+
//
32+
// You can specify all the values or you can default the Build and Revision Numbers
33+
// by using the '*' as shown below:
34+
// [assembly: AssemblyVersion("1.0.*")]
35+
[assembly: AssemblyVersion("1.0.0.0")]
36+
[assembly: AssemblyFileVersion("1.0.0.0")]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<ProjectGuid>{9014BFDD-8311-404A-8B3D-846A7C4D32C7}</ProjectGuid>
8+
<OutputType>Library</OutputType>
9+
<AppDesignerFolder>Properties</AppDesignerFolder>
10+
<RootNamespace>Z.EntityFramework.Classic.DynamicFilters</RootNamespace>
11+
<AssemblyName>Z.EntityFramework.Classic.DynamicFilters</AssemblyName>
12+
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
13+
<FileAlignment>512</FileAlignment>
14+
<Deterministic>true</Deterministic>
15+
</PropertyGroup>
16+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
17+
<DebugSymbols>true</DebugSymbols>
18+
<DebugType>full</DebugType>
19+
<Optimize>false</Optimize>
20+
<OutputPath>bin\Debug\</OutputPath>
21+
<DefineConstants>DEBUG;TRACE</DefineConstants>
22+
<ErrorReport>prompt</ErrorReport>
23+
<WarningLevel>4</WarningLevel>
24+
</PropertyGroup>
25+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
26+
<DebugType>pdbonly</DebugType>
27+
<Optimize>true</Optimize>
28+
<OutputPath>bin\Release\</OutputPath>
29+
<DefineConstants>TRACE;USE_CSPACE</DefineConstants>
30+
<ErrorReport>prompt</ErrorReport>
31+
<WarningLevel>4</WarningLevel>
32+
<DocumentationFile>bin\Release\Z.EntityFramework.Classic.DynamicFilters.xml</DocumentationFile>
33+
</PropertyGroup>
34+
<PropertyGroup>
35+
<SignAssembly>true</SignAssembly>
36+
</PropertyGroup>
37+
<PropertyGroup>
38+
<AssemblyOriginatorKeyFile>zzzproject.pfx</AssemblyOriginatorKeyFile>
39+
</PropertyGroup>
40+
<ItemGroup>
41+
<Reference Include="System" />
42+
<Reference Include="System.ComponentModel.DataAnnotations" />
43+
<Reference Include="System.Core" />
44+
<Reference Include="System.Xml.Linq" />
45+
<Reference Include="System.Data.DataSetExtensions" />
46+
<Reference Include="Microsoft.CSharp" />
47+
<Reference Include="System.Data" />
48+
<Reference Include="System.Xml" />
49+
<Reference Include="Z.EntityFramework.Classic, Version=7.0.0.0, Culture=neutral, PublicKeyToken=afc61983f100d280, processorArchitecture=MSIL">
50+
<HintPath>..\packages\Z.EntityFramework.Classic.7.1.49\lib\net40\Z.EntityFramework.Classic.dll</HintPath>
51+
</Reference>
52+
<Reference Include="Z.EntityFramework.Classic.SqlServer, Version=7.0.0.0, Culture=neutral, PublicKeyToken=afc61983f100d280, processorArchitecture=MSIL">
53+
<HintPath>..\packages\Z.EntityFramework.Classic.7.1.49\lib\net40\Z.EntityFramework.Classic.SqlServer.dll</HintPath>
54+
</Reference>
55+
<Reference Include="Z.EntityFramework.Extensions.Classic, Version=5.2.7.0, Culture=neutral, PublicKeyToken=59b66d028979105b, processorArchitecture=MSIL">
56+
<HintPath>..\packages\Z.EntityFramework.Extensions.Classic.5.2.7\lib\net40\Z.EntityFramework.Extensions.Classic.dll</HintPath>
57+
</Reference>
58+
<Reference Include="Z.Expressions.Eval, Version=4.0.50.0, Culture=neutral, PublicKeyToken=59b66d028979105b, processorArchitecture=MSIL">
59+
<HintPath>..\packages\Z.Expressions.Eval.4.0.50\lib\net40\Z.Expressions.Eval.dll</HintPath>
60+
</Reference>
61+
</ItemGroup>
62+
<ItemGroup>
63+
<Compile Include="Properties\AssemblyInfo.cs" />
64+
</ItemGroup>
65+
<ItemGroup>
66+
<None Include="App.config" />
67+
<None Include="packages.config" />
68+
<None Include="zzzproject.pfx" />
69+
</ItemGroup>
70+
<Import Project="..\EntityFramework.DynamicFilters.Shared\EntityFramework.DynamicFilters.Shared.projitems" Label="Shared" />
71+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
72+
</Project>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<packages>
3+
<package id="Z.EntityFramework.Classic" version="7.1.49" targetFramework="net40" />
4+
<package id="Z.EntityFramework.Extensions.Classic" version="5.2.7" targetFramework="net40" />
5+
<package id="Z.Expressions.Eval" version="4.0.50" targetFramework="net40" />
6+
</packages>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>netstandard2.0</TargetFramework>
5+
<AssemblyName>Z.EntityFramework.Classic.DynamicFilters</AssemblyName>
6+
<RootNamespace>Z.EntityFramework.Classic.DynamicFilters</RootNamespace>
7+
<SignAssembly>true</SignAssembly>
8+
<AssemblyOriginatorKeyFile>zzzproject.pfx</AssemblyOriginatorKeyFile>
9+
</PropertyGroup>
10+
11+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
12+
<DefineConstants>TRACE;USE_CSPACE</DefineConstants>
13+
<DocumentationFile>bin\Release\Z.EntityFramework.Classic.DynamicFilters.xml</DocumentationFile>
14+
</PropertyGroup>
15+
16+
<ItemGroup>
17+
<PackageReference Include="Z.EntityFramework.Classic" Version="7.1.49" />
18+
</ItemGroup>
19+
20+
<Import Project="..\EntityFramework.DynamicFilters.Shared\EntityFramework.DynamicFilters.Shared.projitems" Label="Shared" />
21+
22+
</Project>

0 commit comments

Comments
 (0)