This is a migrated thread and some comments may be shown as answers.

Data Services Version 2 - Error using Projection

5 Answers 124 Views
Web Services
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Axe
Top achievements
Rank 1
Axe asked on 19 Sep 2010, 08:13 AM
I have one simple table and create OpenAccess Domain Model then using Data Service Wizard I Choose Data Services Version 2(Astoria). Code is generated and I configure service then browse to service and all works well. When I try to use projection using $select I get the following error:  

  <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
  <code />
  <message xml:lang="en-AU">An error occurred while processing this request.</message>
- <innererror>
  <message>An exception occured during the execution of ' Extent<CafePal.Data.State>.Select(p => IIF((p == null), null, new ProjectedWrapper2() {ResourceTypeName = "CafePal.Data.State", PropertyNameList = "Name,StateId", ProjectedProperty0 = Convert((p As State).Name), ProjectedProperty1 = Convert(Convert((p As State).StateId))}))'. See InnerException for more details.</message>
  <type>System.InvalidOperationException</type>
  <stacktrace>at Telerik.OpenAccess.Query.ExpressionCompiler.PerformDatabaseQuery(Type type, Int32 elementAt, Object[] groupResolutionParamValues) at Telerik.OpenAccess.Query.ExpressionExecution.PerformDatabaseQuery[T](Piece`1 piece, Object[] grpVals) at Telerik.OpenAccess.Query.Piece`1.System.Collections.IEnumerable.GetEnumerator() at System.Data.Services.Internal.ProjectedWrapper.EnumerableWrapper.GetEnumerator() at System.Data.Services.Internal.ProjectedWrapper.EnumerableWrapper.System.Collections.IEnumerable.GetEnumerator() at System.Data.Services.WebUtil.GetRequestEnumerator(IEnumerable enumerable) at System.Data.Services.DataService`1.SerializeResponseBody(RequestDescription description, IDataService dataService) at System.Data.Services.DataService`1.HandleNonBatchRequest(RequestDescription description) at System.Data.Services.DataService`1.HandleRequest()</stacktrace>
- <internalexception>
  <message>Unable to cast object of type 'System.Object[]' to type 'OpenAccessRuntime.DataObjects.query.Node'.</message>
  <type>System.InvalidCastException</type>
  <stacktrace>at Telerik.OpenAccess.Query.ExpressionCompiler.PerformDatabaseQueryImpl(Type type, Int32 elementAt, Object[] groupResolutionParamValues) at Telerik.OpenAccess.Query.ExpressionCompiler.PerformDatabaseQuery(Type type, Int32 elementAt, Object[] groupResolutionParamValues)</stacktrace>
  </internalexception>
  </innererror>
  </error>

I tried the same thing using EF 4 and it works fine. I also tried this at Telerik TV and it works but I don't know if you are using OpenAccess or EF or Custom eg.http://tv.telerik.com/services/odata.svc/Videos?$select=Name 

5 Answers, 1 is accepted

Sort by
0
Petko_I
Telerik team
answered on 23 Sep 2010, 07:28 AM
Hi Axe,

I am writing to let you know that I was able to reproduce the problem and started investigating the issue. I will let you know what the cause for this problem is as soon as I find it. With regard to the Telerik TV data manager OpenAccess is used.

Thank you for your patience.

All the best,
Petko_I
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Axe
Top achievements
Rank 1
answered on 23 Sep 2010, 09:10 AM
Thanks for looking into it.
I'm just curious: if you are using OpenAccess for Telerik TV then why can I use projection on your service? I just tried http://tv.telerik.com/services/odata.svc/Videos?$select=Name,Rating and it works fine.

Did you guys create a custom Data Service Provider or do you just use the Reflection provider? I'm guessing the reflection provider as the Data Services Wizard creates a DataManager class which really is only IQueryable collections of entities and implementing a few interfaces. But not sure what's happening behind it all. I'm still learning to create custom data service providers but all I see is that the DataManager class doesn't implement any of the interfaces needed.

Anyway, I was just curious how you implemented it.
0
Petko_I
Telerik team
answered on 29 Sep 2010, 08:42 AM
Hello Axe,

I am really sorry for the late reply. The Telerik TV site is managed by one of our evangelists and I am trying to contact him in order to investigate the issue you have found. Currently he is unavailable but when I get in touch with him, I will tell you exactly how the service of the site is implemented.

With regard to the Data Services Wizard your observations are right – we use a Reflection provider for the Data Services V2. Thanks to you we have found out that the generated expression by Microsoft (when the service is queried with a $select) cannot be correctly parsed by our LINQ implementation. We have invented a testing procedure to capture the generated LINQ and can now see why the parsing process is not correct. We will introduce a fix for this issue. Please, find your Telerik points updated for helping us locate the problem.

I will contact you again to shed some light on the Telerik TV site service.

All the best,
Petko_I
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Chris Douglass
Top achievements
Rank 1
answered on 01 Oct 2010, 04:54 PM
Hello. I have same problem. When I sends request http://localhost/Contact2Connection.DAL.Services/Contact2ConnectionDALService.svc/Cultures?$select=CultureID,AddedBy server returns error.

Here information from trace log: The communication object, System.ServiceModel.Channels.TransportReplyChannelAcceptor+TransportReplyChannel, cannot be used for communication because it has been Aborted.

and here information from AppFabric error log:

Exception An exception occured during the execution of '
Extent<Contact2Connection.DAL.Model.Culture>.Select(p => IIF((p == null), null, new ProjectedWrapper2() {ResourceTypeName = "Contact2Connection.DAL.Model.Culture", PropertyNameList = "CultureID,AddedBy", ProjectedProperty0 = Convert(Convert((p As Culture).CultureID)), ProjectedProperty1 = Convert((p As Culture).AddedBy)}))'. See InnerException for more details.
 status code 500.
0
Petko_I
Telerik team
answered on 06 Oct 2010, 06:00 PM
Hi Chris Douglass,

In fact we are aware of the problem. Currently the generated expression for LINQ is incompatible with our parsing procedure and unfortunately there is no workaround for this. We have given high priority for resolving this problem and there will be a new implementation of the data services provider. The Q3 release is drawing near and we will do our best to include this change in it.

All the best,
Petko_I
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Web Services
Asked by
Axe
Top achievements
Rank 1
Answers by
Petko_I
Telerik team
Axe
Top achievements
Rank 1
Chris Douglass
Top achievements
Rank 1
Share this question
or