我在运行时收到异常, 我该怎么做才能解决它?
我将所有内容升级到最新版本。
var query = q as System.Data.Services.Client.DataServiceQuery<T>;
if (continuationToken != null)
{
query = query.AddQueryOption("NextPartitionKey", continuationToken.PartitionKey);
if (continuationToken.RowKey != null)
{
query = query.AddQueryOption("NextRowKey", continuationToken.RowKey);
}
}
// i fall here with the concrete exception I mentioned above
var response = (System.Data.Services.Client.QueryOperationResponse<T>) query.Execute();
result = result.Union(response.ToList<T>());
Exception thrown: 'System.InvalidCastException' in Microsoft.Data.Services.Client.dll
Additional information: Unable to cast object of type 'System.Data.Services.Client.Providers.EdmEntityTypeWithDelayLoadedProperties' to type 'Microsoft.Data.Edm.IEdmComplexType'.
完整筹码:
at System.Data.Services.Client.ClientEdmModel.GetOrCreateEdmTypeInternal(IEdmStructuredType edmBaseType, Type type, PropertyInfo[] keyProperties, Boolean isEntity, Nullable`1 hasProperties)
at System.Data.Services.Client.ClientEdmModel.GetOrCreateEdmTypeInternal(Type type)
at System.Data.Services.Client.ClientEdmModel.GetOrCreateEdmType(Type type)
at System.Data.Services.Client.TypeResolver.ResolveExpectedTypeForReading(Type clientClrType)
at System.Data.Services.Client.Materialization.ODataMaterializer.CreateMaterializerForMessage(IODataResponseMessage responseMessage, ResponseInfo responseInfo, Type materializerType, QueryComponents queryComponents, ProjectionPlan plan, ODataPayloadKind payloadKind)
at System.Data.Services.Client.MaterializeAtom..ctor(ResponseInfo responseInfo, QueryComponents queryComponents, ProjectionPlan plan, IODataResponseMessage responseMessage, ODataPayloadKind payloadKind)
at System.Data.Services.Client.QueryResult.CreateMaterializer(ProjectionPlan plan, ODataPayloadKind payloadKind)
at System.Data.Services.Client.QueryResult.ProcessResult[TElement](ProjectionPlan plan)
at System.Data.Services.Client.DataServiceRequest.Execute[TElement](DataServiceContext context, QueryComponents queryComponents)
at xxx.Data.TableService`1.Select(IQueryable`1 q, Boolean useCache, String cacheKey) in C:\dev\xxx\Development\Platform\xxx.Data\Tables\TableService.cs:line 194