5

Resolved

Support all Edm canonical functions

description

The mmdb doesn't support some really basic functions, like String.IsNullOrEmpty or DateTime.Compare.

Is there some kind of workaround for this, or are these functions planned to be included? My codebase is just littered with these two functions, which renders Effort useless in my use case. :(

comments

tamasflamich wrote Aug 28, 2012 at 9:23 AM

I am aware of the lack of complete EDM function mapping in Effort, it is indeed planned to be fixed.

If you wanted to continue testing the library, you could add additional Edm function support in the following class:
http://effort.codeplex.com/SourceControl/changeset/view/11d013f93a0e#Main%2fSource%2fEffort%2fInternal%2fDbCommandTreeTransformation%2fCanonicalFunctions.cs

Its implementation seems a bit messy, so I will probably redesign it completely.

You can find a complete list of EDM functions here:
http://msdn.microsoft.com/en-us/library/bb738626.aspx

eatfrog wrote Aug 28, 2012 at 9:48 AM

Awesome. Thanks for the quick response. :)

I've been planning to help you out with this project, but it's been difficult to find the time recently. I'll try to take a look at this at some point in the near future.

okiaconvit wrote Oct 20, 2012 at 4:41 AM

First of all, I wanted to say that this is awesome tool for unit testing. However, there is some errors what make me confused, such as:

"There is no matching CLR function in MMDB for function Edm.IndexOf."

As I know, the mmdb does not support IndexOf function, also, I downloaded the code you refer to. But forgive my knowledge, I do not know the way how to add addtional Edm.IndexOf function. I will appreciate that if you can give me a hand, thanks in advance.

tamasflamich wrote Oct 20, 2012 at 1:16 PM

A contributor has been working on this (along with other things) for a while, you can check his implementation at his fork repository:

http://effort.codeplex.com/SourceControl/changeset/8acb420d2571#Main%2fSource%2fEffort%2fInternal%2fDbCommandTreeTransformation%2fCanonicalFunctions.cs

realstrategos wrote Jul 22, 2013 at 8:18 PM

I am having a real issue attempting to implement bitwise operators

The closest I could figure out was something like this, but I cant get it working
public static int BitwiseAnd(int a, int b)
{
            return a & b;
        }
this.mappings["Edm.BitwiseAnd"] = (f, args) =>
                 Expression.Call(
                    null,
                    FindMethod(typeof(DbFunctions), "BitwiseAnd", typeof(int), typeof(int)),
                    args[1],
                    args[0]);
really struggling with this, any help would be greatly appreciated

tamasflamich wrote Jul 26, 2013 at 1:18 PM

I will take a look at this as soon as I can.

realstrategos wrote Aug 2, 2013 at 4:37 PM

Thanks for looking at this, my testing project plans have been put on hold until I can get past this last hurdle

realstrategos wrote Aug 12, 2013 at 7:15 PM

Has there been any update to this yet? Still stalled ...

Cant wait to write the new tests and to speed up my existing tests!

tamasflamich wrote Aug 13, 2013 at 10:03 AM

Yes, sorry for not sending a notification.

Check most recent source code or nightly builds.

memark wrote Apr 27 at 3:47 PM

What is the status right now? Are these functions still not supported?

realstrategos wrote Aug 22 at 12:33 PM

I just opened an issue https://effort.codeplex.com/workitem/729 as it appears that it attempts to do the operations but fails