System.Linq.Dynamic.Core icon indicating copy to clipboard operation
System.Linq.Dynamic.Core copied to clipboard

Adding LIKE operator for EF6

Open czielin opened this issue 8 years ago • 4 comments

I'm trying to figure out if there is a way to add to call a method that translates to the TSQL LIKE operator when executing against Sql Server using EF6. It looks like this was done for EF Core here:

https://github.com/StefH/System.Linq.Dynamic.Core/issues/105

I was going to take a crack at using the commit for this issue to see if I could add something myself, but I'm unable to get the solution to build. When I load it in VS 2017 the nuget dependencies refuse to load and I am presented with the following error.

Error MSB4019 The imported project "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Microsoft\WindowsXaml\v15.0\Microsoft.Windows.UI.Xaml.CSharp.targets" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk. System.Linq.Dynamic.Core C:\Program Files\dotnet\sdk\2.0.2\Sdks\Microsoft.NET.Sdk\Sdk\Sdk.targets 41

I've tried this on two different machines. Do I need my environment set up in a particular way to load this solution?

Further, is this worth the time investment, or is there some reason this will not work like it does for EF Core?

Thanks!

czielin avatar Dec 23 '17 16:12 czielin

Please disregard (for now).

Even though I couldn't build digging into the project helped me discover that it already references the proper EF6 classes, and I think I've figured out the proper syntax.

queryable.Where("parts.any(DbFunctions.Like(common.type, @0)) ", "%test");

czielin avatar Dec 23 '17 17:12 czielin

Cool. Does this work for you?

StefH avatar Dec 23 '17 17:12 StefH

About the solution ; you need UWP to be installed;

uwp

StefH avatar Dec 24 '17 08:12 StefH

@StefH it took me a bit to build some tests around it, but now that I have the syntax worked out it all appears to be working well. Thanks!

Thanks also for the tip on UWP. I will give that a shot should I need to dive into the code again.

czielin avatar Dec 26 '17 22:12 czielin