From d937fa716029cd3dfa364ecddd20c7455b87a3cc Mon Sep 17 00:00:00 2001 From: Stef Heyenrath Date: Thu, 22 Aug 2019 21:38:09 +0200 Subject: [PATCH] ConsoleApp_net452_EF6_Effort --- System.Linq.Dynamic.Core.sln | 27 +++- .../Entities/KendoGridDbContext.cs | 8 +- .../ConsoleApp_net452_EF6_Effort/App.config | 19 +++ .../ConsoleApp_net452_EF6_Effort.csproj | 145 ++++++++++++++++++ .../ConsoleApp_net452_EF6_Effort/Program.cs | 56 +++++++ .../Properties/AssemblyInfo.cs | 35 +++++ .../packages.config | 9 ++ 7 files changed, 294 insertions(+), 5 deletions(-) create mode 100644 src-console/ConsoleApp_net452_EF6_Effort/App.config create mode 100644 src-console/ConsoleApp_net452_EF6_Effort/ConsoleApp_net452_EF6_Effort.csproj create mode 100644 src-console/ConsoleApp_net452_EF6_Effort/Program.cs create mode 100644 src-console/ConsoleApp_net452_EF6_Effort/Properties/AssemblyInfo.cs create mode 100644 src-console/ConsoleApp_net452_EF6_Effort/packages.config diff --git a/System.Linq.Dynamic.Core.sln b/System.Linq.Dynamic.Core.sln index 4506baf8..44d39458 100644 --- a/System.Linq.Dynamic.Core.sln +++ b/System.Linq.Dynamic.Core.sln @@ -74,12 +74,11 @@ Project("{7CF6DF6D-3B04-46F8-A40B-537D21BCA0B4}") = "System.Linq.Dynamic.Core", {D3804228-91F4-4502-9595-39584E510002} = {D3804228-91F4-4502-9595-39584E510002} EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleAppPerformanceTest236", "src-console\ConsoleAppPerformanceTest236\ConsoleAppPerformanceTest236.csproj", "{E9C52E5E-28DC-4D45-B9AB-1B2CF2924A84}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConsoleAppPerformanceTest236", "src-console\ConsoleAppPerformanceTest236\ConsoleAppPerformanceTest236.csproj", "{E9C52E5E-28DC-4D45-B9AB-1B2CF2924A84}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApp_net452_EF6_Effort", "src-console\ConsoleApp_net452_EF6_Effort\ConsoleApp_net452_EF6_Effort.csproj", "{36B101B1-720B-4770-B222-C6ADD464F9EC}" EndProject Global - GlobalSection(Performance) = preSolution - HasPerformanceSessions = true - EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Debug|ARM = Debug|ARM @@ -409,6 +408,22 @@ Global {E9C52E5E-28DC-4D45-B9AB-1B2CF2924A84}.Release|x64.Build.0 = Release|Any CPU {E9C52E5E-28DC-4D45-B9AB-1B2CF2924A84}.Release|x86.ActiveCfg = Release|Any CPU {E9C52E5E-28DC-4D45-B9AB-1B2CF2924A84}.Release|x86.Build.0 = Release|Any CPU + {36B101B1-720B-4770-B222-C6ADD464F9EC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {36B101B1-720B-4770-B222-C6ADD464F9EC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {36B101B1-720B-4770-B222-C6ADD464F9EC}.Debug|ARM.ActiveCfg = Debug|Any CPU + {36B101B1-720B-4770-B222-C6ADD464F9EC}.Debug|ARM.Build.0 = Debug|Any CPU + {36B101B1-720B-4770-B222-C6ADD464F9EC}.Debug|x64.ActiveCfg = Debug|Any CPU + {36B101B1-720B-4770-B222-C6ADD464F9EC}.Debug|x64.Build.0 = Debug|Any CPU + {36B101B1-720B-4770-B222-C6ADD464F9EC}.Debug|x86.ActiveCfg = Debug|Any CPU + {36B101B1-720B-4770-B222-C6ADD464F9EC}.Debug|x86.Build.0 = Debug|Any CPU + {36B101B1-720B-4770-B222-C6ADD464F9EC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {36B101B1-720B-4770-B222-C6ADD464F9EC}.Release|Any CPU.Build.0 = Release|Any CPU + {36B101B1-720B-4770-B222-C6ADD464F9EC}.Release|ARM.ActiveCfg = Release|Any CPU + {36B101B1-720B-4770-B222-C6ADD464F9EC}.Release|ARM.Build.0 = Release|Any CPU + {36B101B1-720B-4770-B222-C6ADD464F9EC}.Release|x64.ActiveCfg = Release|Any CPU + {36B101B1-720B-4770-B222-C6ADD464F9EC}.Release|x64.Build.0 = Release|Any CPU + {36B101B1-720B-4770-B222-C6ADD464F9EC}.Release|x86.ActiveCfg = Release|Any CPU + {36B101B1-720B-4770-B222-C6ADD464F9EC}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -434,8 +449,12 @@ Global {926D446C-8358-465A-AFAC-2F9078C22262} = {ECA5702B-5D32-4888-A34E-9461FC533F23} {591F9224-A8D6-49CF-8AF8-F9B383C1F9FF} = {1384C18E-DCF3-4A5B-9560-2BF5DD8C51CE} {E9C52E5E-28DC-4D45-B9AB-1B2CF2924A84} = {7971CAEB-B9F2-416B-966D-2D697C4C1E62} + {36B101B1-720B-4770-B222-C6ADD464F9EC} = {7971CAEB-B9F2-416B-966D-2D697C4C1E62} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {94C56722-194E-4B8B-BC23-B3F754E89A20} EndGlobalSection + GlobalSection(Performance) = preSolution + HasPerformanceSessions = true + EndGlobalSection EndGlobal diff --git a/src-console/ConsoleApp_net452_EF6/Entities/KendoGridDbContext.cs b/src-console/ConsoleApp_net452_EF6/Entities/KendoGridDbContext.cs index b724e54c..3853ea48 100644 --- a/src-console/ConsoleApp_net452_EF6/Entities/KendoGridDbContext.cs +++ b/src-console/ConsoleApp_net452_EF6/Entities/KendoGridDbContext.cs @@ -1,10 +1,16 @@ +using System.Data.Common; using System.Data.Entity; using System.Linq.Dynamic.Core.ConsoleTestApp.net452.Entities; namespace ConsoleApp_net452_EF6.Entities { - public partial class KendoGridDbContext : DbContext + public class KendoGridDbContext : DbContext { + public KendoGridDbContext(DbConnection connection) + : base(connection, false) + { + } + public KendoGridDbContext() : base("name=KendoGrid") { diff --git a/src-console/ConsoleApp_net452_EF6_Effort/App.config b/src-console/ConsoleApp_net452_EF6_Effort/App.config new file mode 100644 index 00000000..bec1129d --- /dev/null +++ b/src-console/ConsoleApp_net452_EF6_Effort/App.config @@ -0,0 +1,19 @@ + + + + + + + diff --git a/src-console/ConsoleApp_net452_EF6_Effort/ConsoleApp_net452_EF6_Effort.csproj b/src-console/ConsoleApp_net452_EF6_Effort/ConsoleApp_net452_EF6_Effort.csproj new file mode 100644 index 00000000..bbc9dcde --- /dev/null +++ b/src-console/ConsoleApp_net452_EF6_Effort/ConsoleApp_net452_EF6_Effort.csproj @@ -0,0 +1,145 @@ + + + + + Debug + AnyCPU + {36B101B1-720B-4770-B222-C6ADD464F9EC} + Exe + ConsoleApp_net452_EF6 + ConsoleApp_net452_EF6 + v4.5.2 + 512 + publish\ + true + Disk + false + Foreground + 7 + Days + false + false + true + 0 + 1.0.0.%2a + false + false + true + + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + false + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + false + + + + ..\..\packages\Effort.EF6.2.2.2\lib\net45\Effort.dll + + + ..\..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll + + + ..\..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.SqlServer.dll + + + ..\..\packages\FSharp.Core.4.2.3\lib\net45\FSharp.Core.dll + True + + + ..\..\packages\Linq.Expression.Optimizer.1.0.9\lib\net45\Linq.Expression.Optimizer.dll + + + ..\..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll + + + ..\..\packages\NMemory.3.1.0\lib\net45\NMemory.dll + + + + + + + + + + + + + Entities\Company.cs + + + Entities\Country.cs + + + Entities\Employee.cs + + + Entities\Function.cs + + + Entities\KendoGridDbContext.cs + + + Entities\MainCompany.cs + + + Entities\OU.cs + + + Entities\Product.cs + + + Entities\Role.cs + + + Entities\SubFunction.cs + + + Entities\User.cs + + + Entities\VW_EmployeeDetails.cs + + + + + + + False + .NET Framework 3.5 SP1 + false + + + + + + + + + {8b9ceafa-ed50-4682-8531-a082cfd3fdae} + EntityFramework.DynamicLinq + + + {b70cd050-3b9c-406c-85fd-1a26394ec7c8} + System.Linq.Dynamic.Core + + + + \ No newline at end of file diff --git a/src-console/ConsoleApp_net452_EF6_Effort/Program.cs b/src-console/ConsoleApp_net452_EF6_Effort/Program.cs new file mode 100644 index 00000000..efbf1281 --- /dev/null +++ b/src-console/ConsoleApp_net452_EF6_Effort/Program.cs @@ -0,0 +1,56 @@ +using System; +using System.Linq; +using System.Linq.Dynamic.Core; +using ConsoleApp_net452_EF6.Entities; +using Effort; +using Newtonsoft.Json; + +namespace ConsoleApp_net452_EF6 +{ + class Program + { + static void Main(string[] args) + { + var connection = DbConnectionFactory.CreateTransient(); + + using (var context = new KendoGridDbContext(connection)) + { + context.KendoGridCountry.Add(new Country { Code = "NL", Name = "Nederland" }); + + var main1 = new MainCompany { Name = "Main1" }; + context.KendoGridMainCompany.Add(main1); + + var main2 = new MainCompany { Name = "Main2" }; + context.KendoGridMainCompany.Add(main2); + + var company = new Company { Name = "Other", MainCompany = main1 }; + context.KendoGridCompany.Add(company); + + context.SaveChanges(); + } + + using (var context = new KendoGridDbContext(connection)) + { + foreach (var c in context.KendoGridCountry.AsNoTracking().Where(c => c.Code.StartsWith("N"))) + { + Console.WriteLine(JsonConvert.SerializeObject(c, Formatting.Indented)); + } + + var main2Id = context.KendoGridMainCompany.First(mc => mc.Name == "Main2").Id; + + var company = context.KendoGridCompany.First(); + company.MainCompanyId = main2Id; + + context.SaveChanges(); + } + + using (var context = new KendoGridDbContext(connection)) + { + foreach (var c in context.KendoGridCompany.AsNoTracking()) + { + Console.WriteLine(c.Name + " " + c.MainCompany.Name); + } + } + } + } +} diff --git a/src-console/ConsoleApp_net452_EF6_Effort/Properties/AssemblyInfo.cs b/src-console/ConsoleApp_net452_EF6_Effort/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..85ab673a --- /dev/null +++ b/src-console/ConsoleApp_net452_EF6_Effort/Properties/AssemblyInfo.cs @@ -0,0 +1,35 @@ +using System.Reflection; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("ConsoleApp_net452_EF6_Effort")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("ConsoleApp_net452_EF6_Effort")] +[assembly: AssemblyCopyright("Copyright © Stef Heyenrath 2019")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("5dc68e83-abaa-4887-b17e-1ed4eee89c2c")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// 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("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/src-console/ConsoleApp_net452_EF6_Effort/packages.config b/src-console/ConsoleApp_net452_EF6_Effort/packages.config new file mode 100644 index 00000000..9cfe7e6d --- /dev/null +++ b/src-console/ConsoleApp_net452_EF6_Effort/packages.config @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file