diff --git a/PoweredSoft.DynamicLinq.Dal/App.config b/PoweredSoft.DynamicLinq.Dal/App.config
index 2fb423e..54332e3 100644
--- a/PoweredSoft.DynamicLinq.Dal/App.config
+++ b/PoweredSoft.DynamicLinq.Dal/App.config
@@ -1,13 +1,13 @@
-
+
-
+
-
+
-
+
-
\ No newline at end of file
+
diff --git a/PoweredSoft.DynamicLinq.Dal/PoweredSoft.DynamicLinq.Dal.csproj b/PoweredSoft.DynamicLinq.Dal/PoweredSoft.DynamicLinq.Dal.csproj
index 701aa82..2dab09c 100644
--- a/PoweredSoft.DynamicLinq.Dal/PoweredSoft.DynamicLinq.Dal.csproj
+++ b/PoweredSoft.DynamicLinq.Dal/PoweredSoft.DynamicLinq.Dal.csproj
@@ -9,8 +9,9 @@
Properties
PoweredSoft.DynamicLinq.Dal
PoweredSoft.DynamicLinq.Dal
- v4.6.1
+ v4.6.2
512
+
true
diff --git a/PoweredSoft.DynamicLinq.EntityFramework/App.config b/PoweredSoft.DynamicLinq.EntityFramework/App.config
new file mode 100644
index 0000000..7e1d79c
--- /dev/null
+++ b/PoweredSoft.DynamicLinq.EntityFramework/App.config
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/PoweredSoft.DynamicLinq.EntityFramework/Extensions/DbContextExtensions.cs b/PoweredSoft.DynamicLinq.EntityFramework/Extensions/DbContextExtensions.cs
new file mode 100644
index 0000000..438dbbf
--- /dev/null
+++ b/PoweredSoft.DynamicLinq.EntityFramework/Extensions/DbContextExtensions.cs
@@ -0,0 +1,35 @@
+using System;
+using System.Collections.Generic;
+using System.Data.Entity;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+using System.Threading.Tasks;
+using PoweredSoft.DynamicLinq.Extensions;
+using PoweredSoft.DynamicLinq.Fluent;
+
+namespace PoweredSoft.DynamicLinq.EntityFramework.Extensions
+{
+ public static class DbContextExtensions
+ {
+ private static readonly MethodInfo QueryMethod = typeof(DbContextExtensions)
+ .GetMethods(BindingFlags.Static | BindingFlags.Public)
+ .First(t => t.Name == "Query" && t.IsGenericMethod);
+
+ public static IQueryable Query(this DbContext context, Type pocoType, Action callback)
+ {
+ var method = QueryMethod.MakeGenericMethod(pocoType);
+ var invokeResult = method.Invoke(null, new object[] {context, callback});
+ var ret = invokeResult as IQueryable;
+ return ret;
+ }
+
+ public static IQueryable Query(this DbContext context, Action callback)
+ where T : class
+ {
+ var query = context.Set().AsQueryable();
+ query = query.Query(callback);
+ return query;
+ }
+ }
+}
diff --git a/PoweredSoft.DynamicLinq.EntityFramework/PoweredSoft.DynamicLinq.EntityFramework.csproj b/PoweredSoft.DynamicLinq.EntityFramework/PoweredSoft.DynamicLinq.EntityFramework.csproj
new file mode 100644
index 0000000..034fbcb
--- /dev/null
+++ b/PoweredSoft.DynamicLinq.EntityFramework/PoweredSoft.DynamicLinq.EntityFramework.csproj
@@ -0,0 +1,64 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {15587E3C-D4BB-474C-A4AC-4E6305F92BCE}
+ Library
+ Properties
+ PoweredSoft.DynamicLinq.EntityFramework
+ PoweredSoft.DynamicLinq.EntityFramework
+ v4.6.2
+ 512
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+ ..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll
+
+
+ ..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.SqlServer.dll
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {2ABC5A60-B549-4ECD-BEF4-31CA7BA4EF06}
+ PoweredSoft.DynamicLinq
+
+
+
+
\ No newline at end of file
diff --git a/PoweredSoft.DynamicLinq.EntityFramework/Properties/AssemblyInfo.cs b/PoweredSoft.DynamicLinq.EntityFramework/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..29401cd
--- /dev/null
+++ b/PoweredSoft.DynamicLinq.EntityFramework/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+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("PoweredSoft.DynamicLinq.EntityFramework")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("PoweredSoft.DynamicLinq.EntityFramework")]
+[assembly: AssemblyCopyright("Copyright © 2018")]
+[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("15587e3c-d4bb-474c-a4ac-4e6305f92bce")]
+
+// 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/PoweredSoft.DynamicLinq.EntityFramework/packages.config b/PoweredSoft.DynamicLinq.EntityFramework/packages.config
new file mode 100644
index 0000000..02a4d9b
--- /dev/null
+++ b/PoweredSoft.DynamicLinq.EntityFramework/packages.config
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/PoweredSoft.DynamicLinq.Test/EntityFrameworkTests.cs b/PoweredSoft.DynamicLinq.Test/EntityFrameworkTests.cs
index 31cf0c3..093294b 100644
--- a/PoweredSoft.DynamicLinq.Test/EntityFrameworkTests.cs
+++ b/PoweredSoft.DynamicLinq.Test/EntityFrameworkTests.cs
@@ -1,9 +1,11 @@
using System;
using System.Collections.Generic;
+using System.Data.Entity;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using PoweredSoft.DynamicLinq.Dal;
using PoweredSoft.DynamicLinq.Dal.Pocos;
+using PoweredSoft.DynamicLinq.EntityFramework.Extensions;
using PoweredSoft.DynamicLinq.Extensions;
namespace PoweredSoft.DynamicLinq.Test
@@ -174,5 +176,17 @@ namespace PoweredSoft.DynamicLinq.Test
for (var i = 0; i < dq.Count; i++)
Assert.AreEqual(dq[i].Id, sq[i].Id);
}
+
+ [TestMethod]
+ public void TestContextTypeLessHelper()
+ {
+ var context = new BlogContext(testConnectionString);
+ SeedForTests(context);
+
+ var queryable = context.Query(typeof(Author), q => q.Compare("FirstName", ConditionOperators.Equal, "David"));
+ var result = queryable.ToListAsync().Result;
+ var first = result.FirstOrDefault() as Author;
+ Assert.AreEqual(first?.FirstName, "David");
+ }
}
}
diff --git a/PoweredSoft.DynamicLinq.Test/PoweredSoft.DynamicLinq.Test.csproj b/PoweredSoft.DynamicLinq.Test/PoweredSoft.DynamicLinq.Test.csproj
index 209cea0..81a8bbf 100644
--- a/PoweredSoft.DynamicLinq.Test/PoweredSoft.DynamicLinq.Test.csproj
+++ b/PoweredSoft.DynamicLinq.Test/PoweredSoft.DynamicLinq.Test.csproj
@@ -9,7 +9,7 @@
Properties
PoweredSoft.DynamicLinq.Test
PoweredSoft.DynamicLinq.Test
- v4.6.1
+ v4.6.2
512
{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
15.0
@@ -19,6 +19,7 @@
UnitTest
+
true
@@ -73,6 +74,10 @@
{C16927E7-1358-4B9D-BDD7-149E505DE6CC}
PoweredSoft.DynamicLinq.Dal
+
+ {15587e3c-d4bb-474c-a4ac-4e6305f92bce}
+ PoweredSoft.DynamicLinq.EntityFramework
+
{2abc5a60-b549-4ecd-bef4-31ca7ba4ef06}
PoweredSoft.DynamicLinq
diff --git a/PoweredSoft.DynamicLinq.sln b/PoweredSoft.DynamicLinq.sln
index 9a9401f..1752a19 100644
--- a/PoweredSoft.DynamicLinq.sln
+++ b/PoweredSoft.DynamicLinq.sln
@@ -9,6 +9,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PoweredSoft.DynamicLinq.Dal
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PoweredSoft.DynamicLinq.Test", "PoweredSoft.DynamicLinq.Test\PoweredSoft.DynamicLinq.Test.csproj", "{6F5C80F0-9045-4098-913F-7BDAD135E6DD}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PoweredSoft.DynamicLinq.EntityFramework", "PoweredSoft.DynamicLinq.EntityFramework\PoweredSoft.DynamicLinq.EntityFramework.csproj", "{15587E3C-D4BB-474C-A4AC-4E6305F92BCE}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -27,6 +29,10 @@ Global
{6F5C80F0-9045-4098-913F-7BDAD135E6DD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6F5C80F0-9045-4098-913F-7BDAD135E6DD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6F5C80F0-9045-4098-913F-7BDAD135E6DD}.Release|Any CPU.Build.0 = Release|Any CPU
+ {15587E3C-D4BB-474C-A4AC-4E6305F92BCE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {15587E3C-D4BB-474C-A4AC-4E6305F92BCE}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {15587E3C-D4BB-474C-A4AC-4E6305F92BCE}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {15587E3C-D4BB-474C-A4AC-4E6305F92BCE}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/PoweredSoft.DynamicLinq/PoweredSoft.DynamicLinq.csproj b/PoweredSoft.DynamicLinq/PoweredSoft.DynamicLinq.csproj
index a2894bd..99d2435 100644
--- a/PoweredSoft.DynamicLinq/PoweredSoft.DynamicLinq.csproj
+++ b/PoweredSoft.DynamicLinq/PoweredSoft.DynamicLinq.csproj
@@ -9,8 +9,9 @@
Properties
PoweredSoft.DynamicLinq
PoweredSoft.DynamicLinq
- v4.6.1
+ v4.6.2
512
+
true