This question is locked. New answers and comments are not allowed.
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:
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
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
standalone
=
"yes"
?>
- <
error
xmlns
=
"http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
>
<
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