Hi,
I have a view model using 2 differents models. I am using on single EntityManager (not one of the autogenerated by devforce with the model) to manage them.
To be able to call specific Query on the server I created a Named Query but when I try to call it from the client I get the following error :
Caught exception: System.Exception: Unable to locate public query method on
server for: 'GetPatientsFromIPP' à
IdeaBlade.EntityModel.Edm.UdtTransformVisitor.GetUdtQueryable(String
entitySetName, Type returnEntityType, List`1 parameters) à
IdeaBlade.EntityModel.Edm.UdtTransformVisitor.VisitConstant(ConstantExpression
ce) à IdeaBlade.Linq.ExpressionVisitor.VisitExpressionCore(Expression e) à
IdeaBlade.Linq.TransformExpressionVisitor.VisitExpressionCore(Expression expr) à
IdeaBlade.Linq.ExpressionVisitor.VisitExpression(Expression expr) à
IdeaBlade.Linq.ExpressionVisitor.Visit(Expression expr) à
IdeaBlade.EntityModel.Edm.UdtTransformVisitor.Transform(EntityQuery query) à
IdeaBlade.EntityModel.Server.EntityServer.Fetch(SessionBundle sessionBundle,
IEntityQuerySurrogate surrogate) à SyncInvokeFetch(Object , Object[] , Object[]
) à System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance,
Object[] inputs, Object[]& outputs) à
System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc&
rpc) à
System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc&
rpc) à
System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage41(MessageRpc&
rpc) à
System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc&
rpc) à
System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc&
rpc) à
System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage3(MessageRpc&
rpc) à
System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage2(MessageRpc&
rpc) à
System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage11(MessageRpc&
rpc) à
System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage1(MessageRpc&
rpc) à System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean
isOperationContextSet)
I did exactly what it is said in the documentation (well I think).
My model assembly is correctly probed by the server :
Probe Assemblies: Test.Common.Domain, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=null :: Test.Patients.Server.Domain, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null
In the model assembly (on the server) I added a class with my query definition
[EnableClientAccess]
public class PatientNamedQueryProvider
{
public IQueryable<Patient> GetPatientsFromIPP(string ipp)
{
return new EntityQuery<Patient>().Include("Personne").Where(p => p.IPP == ipp);
}In my Dataservices on the client here is my Code (I have a reference to the client model which doesn't know the PatientNamedQueryProvider Class) :
public void GetPatientsFromIPP(string ipp, Action<IEnumerable<Patient>> onSuccess, Action<Exception> onFail)
{
var qry = new EntityQuery<Patient>("GetPatientsFromIPP");
qry.Parameters.Add(new EntityQueryParameter(ipp));
Manager.ExecuteQueryAsync(qry, (op) =>
{
if (op.CompletedSuccessfully)
{
if (null != onSuccess)
{
onSuccess(op.Results);
}
else
{
if (null != onFail)
{
op.MarkErrorAsHandled();
onFail(op.Error);
}
}
}
});
}
I first though I had an issue because of the parameters so I tried without and I get the same error.
What I am missing ?