Showing posts with label Telerik ORM. Show all posts
Showing posts with label Telerik ORM. Show all posts

Jun 7, 2010

Open Access Exception : Please reformulate the query so that the parameter appears on the right side.

You may come up with this exception : Please reformulate the query so that the parameter appears on the right side. in Telerik Open Access

If you have something like:

query = query.Where(x => x.Positive == (positive ? 1 : -1));

The bolded text is an iif expression that the Open Access Linq driver cannot evaluate.

The solution is to use something like:

int iPositive = positive ? 1 : -1
This way the SQL will have the evaluated expression and will know how to deal with it.

NOTE: As far as I know this issue is fixed in the latest releases of Open Access ORM.

Jun 2, 2010

Telerik Open Access exception : The assembly 'xxx' does not have a config file with an openaccess node.

In some old versions of Telerik Open Access you may come to this exception.
I am not quite sure about the latest versions.
However, I've found a forum post that explains that this exception occurs if your project wasn't yet enabled for Open Access.
This wasn't my case so I tried some other things.
At the end, it appeared that "The assembly 'xxx' does not have a config file with an openaccess node" exception may occur if your app.config file is broken. It should be a valid XML file. In my case I have forgotten to close a <class> node with its corresponding </class> ...

Edit: As Yosif Yosifov stated, there is an easier way to check if your app.config file is fine. Simply select Telerik -> Open Access -> Configuration -> Check Settings ... dialog from Visual Studio menu.