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