New Posts New Posts RSS Feed: Cannot get result of a Parametrized named query using Fakestore mode
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Cannot get result of a Parametrized named query using Fakestore mode

 Post Reply Post Reply
Author
kdev View Drop Down
Groupie
Groupie
Avatar

Joined: 03-Jan-2013
Posts: 83
Post Options Post Options   Quote kdev Quote  Post ReplyReply Direct Link To This Post Topic: Cannot get result of a Parametrized named query using Fakestore mode
    Posted: 26-Feb-2013 at 7:54pm
thank you
Back to Top
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 1391
Post Options Post Options   Quote kimj Quote  Post ReplyReply Direct Link To This Post Posted: 15-Feb-2013 at 10:07am
kdev - We've fixed this problem in the upcoming 7.1.0 release.
Back to Top
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 1391
Post Options Post Options   Quote kimj Quote  Post ReplyReply Direct Link To This Post Posted: 25-Jan-2013 at 8:15am
Sorry I hadn't gotten back to you. Named queries are the best approach for your needs. I've been trying to get in touch with the original engineer to see why the restriction with faking exists.
Back to Top
kdev View Drop Down
Groupie
Groupie
Avatar

Joined: 03-Jan-2013
Posts: 83
Post Options Post Options   Quote kdev Quote  Post ReplyReply Direct Link To This Post Posted: 25-Jan-2013 at 12:12am
Any though about how to share this logic between the client and the server without duplicate the code ?
Back to Top
kdev View Drop Down
Groupie
Groupie
Avatar

Joined: 03-Jan-2013
Posts: 83
Post Options Post Options   Quote kdev Quote  Post ReplyReply Direct Link To This Post Posted: 22-Jan-2013 at 1:30pm
I want to share some logic between the client and the server.

Actually all my queries are define on the client (Silverlight) and some might be very complex.
This fits my needs when I only need to show the result on the screen, but often I need to print this result.
For the reporting parts, I use Telerik Reporting. All the reports are generated on the server.

I don't want to duplicate and maintain the code for those queries on both side, that's why I wanted to use the "specialized" queries which seemed to fits my needs.

Now I use a lot the FakeStore as it is in Temphire. If I can't use the "specilaized" queries in the Fake mode then that's an issue for me.

Any other way to share query logic between client and server with devforce ?

Back to Top
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 1391
Post Options Post Options   Quote kimj Quote  Post ReplyReply Direct Link To This Post Posted: 22-Jan-2013 at 1:19pm
Using "specialized" named queries when faking is not currently supported.  These queries must be executed with the DataSourceOnly strategy by definition, and faking, by definition, uses a disconnected EntityManager to mimic the data store.
 
How important is this feature for you?
Back to Top
kdev View Drop Down
Groupie
Groupie
Avatar

Joined: 03-Jan-2013
Posts: 83
Post Options Post Options   Quote kdev Quote  Post ReplyReply Direct Link To This Post Posted: 22-Jan-2013 at 1:43am
Hi,

I’m trying to make a parametrized named query request and then get its corresponding results.
The request is the following

              // on the client in a repository class 
        public Task<IEnumerable<Company>> GetCompaniesStartingWithPrefix(string prefix)
        {
            return Manager.GetCompaniesStartingWithPrefix(prefix).ExecuteAsync();
        }

              // exists in the entity manager class
        public EntityQuery<company> GetCompaniesStartingWithPrefix(string prefix)
        {
            var query = new EntityQuery<Company>("CompaniesStartingWithPrefix", this);
            query.AddParameter(new EntityQueryParameter(prefix));
            return query;
        }

In which I try to get a set of “Company” records which satisfy a certain condition.
In the server side , I wrote the following code:

    [EnableClientAccess]
    public class CompaniesNamedQueryProvider
    {
        public IQueryable<Company> GetCompaniesStartingWithPrefix(string prefix)
        {
            return new EntityQuery<Company>().Where(item => item.Name.StartsWith(prefix));
        }
    }

The problem was that – in fakestore mode - I encountered the following problem:
EntityServerException: named queries must have a FetchStrategy of either DataSourceOnly or Optimized.

Even if change the value of the QueryStrategy property of the EntityQuery instance used for the request to “DataSourceOnly” value, there is no effect.

The same scenario in “Debug” mode works fine.

Did I missed something ??

Note :
DevForce version : 7.0.3.0
cocktail 2.2

Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down