私は WCF Data Service を使用しており、正常に動作する LINQ to Entities クエリがあります。
var result =
(from data1 in context.Data
join info in context.Information on data1.inf_ID equals info.ID
select info );
return result.AsQueryable();
次のコードを使用する場合:
string[] ids ={"1","2","3"};
var result =
(from data1 in context.Data
join info in context.Information on data1.inf_ID equals info.ID
where ids.Contains(info.ID.ToString())
select info);
return result.AsQueryable();
次の例外とスタック トレースが表示されます。
Exception has been thrown by the target of an invocation.
Stacktrace: at: System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
at: System.RuntimeMethodHandle.InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
at: System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at: System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at: System.Data.Services.Providers.BaseServiceProvider.InvokeServiceOperation(ServiceOperation serviceOperation, Object[] parameters)
at: System.Data.Services.Providers.EntityFrameworkDataServiceProvider.InvokeServiceOperation(ServiceOperation serviceOperation, Object[] parameters)
at: System.Data.Services.Providers.DataServiceProviderWrapper.InvokeServiceOperation(OperationWrapper serviceOperation, Object[] parameters)
at: System.Data.Services.RequestUriProcessor.ComposeExpressionForServiceOperation(SegmentInfo segment, IDataService service, Boolean checkRights, SegmentInfo lastSegment)
at: System.Data.Services.RequestUriProcessor.ComposeExpressionForSegments(ICollection`1 parsedSegments, IDataService service)
at: System.Data.Services.RequestUriProcessor.ProcessRequestUri(Uri absoluteRequestUri, IDataService service, Boolean internalQuery)
at: System.Data.Services.DataService`1.ProcessIncomingRequestUri()
at: System.Data.Services.DataService`1.HandleRequest()
INNER EXCEPTION: null
Stacktrace: at: System.Data.Objects.ELinq.ExpressionConverter.MethodCallTranslator.DefaultTranslator.Translate(ExpressionConverter parent, MethodCallExpression call)
at: System.Data.Objects.ELinq.ExpressionConverter.MethodCallTranslator.TypedTranslate(ExpressionConverter parent, MethodCallExpression linq)
at: System.Data.Objects.ELinq.ExpressionConverter.TypedTranslator`1.Translate(ExpressionConverter parent, Expression linq)
at: System.Data.Objects.ELinq.ExpressionConverter.TranslateExpression(Expression linq)
at: System.Data.Objects.ELinq.ExpressionConverter.MethodCallTranslator.ContainsTranslator.TranslateContains(ExpressionConverter parent, Expression sourceExpression, Expression valueExpression)
at: System.Data.Objects.ELinq.ExpressionConverter.MethodCallTranslator.ContainsTranslator.Translate(ExpressionConverter parent, MethodCallExpression call)
at: System.Data.Objects.ELinq.ExpressionConverter.MethodCallTranslator.SequenceMethodTranslator.Translate(ExpressionConverter parent, MethodCallExpression call, SequenceMethod sequenceMethod)
at: System.Data.Objects.ELinq.ExpressionConverter.MethodCallTranslator.TypedTranslate(ExpressionConverter parent, MethodCallExpression linq)
at: System.Data.Objects.ELinq.ExpressionConverter.TypedTranslator`1.Translate(ExpressionConverter parent, Expression linq)
at: System.Data.Objects.ELinq.ExpressionConverter.TranslateExpression(Expression linq)
at: System.Data.Objects.ELinq.ExpressionConverter.BinaryTranslator.TypedTranslate(ExpressionConverter parent, BinaryExpression linq)
at: System.Data.Objects.ELinq.ExpressionConverter.TypedTranslator`1.Translate(ExpressionConverter parent, Expression linq)
at: System.Data.Objects.ELinq.ExpressionConverter.TranslateExpression(Expression linq)
at: System.Data.Objects.ELinq.ExpressionConverter.BinaryTranslator.TypedTranslate(ExpressionConverter parent, BinaryExpression linq)
at: System.Data.Objects.ELinq.ExpressionConverter.TypedTranslator`1.Translate(ExpressionConverter parent, Expression linq)
at: System.Data.Objects.ELinq.ExpressionConverter.TranslateExpression(Expression linq)
at: System.Data.Objects.ELinq.ExpressionConverter.TranslateLambda(LambdaExpression lambda, DbExpression input)
at: System.Data.Objects.ELinq.ExpressionConverter.TranslateLambda(LambdaExpression lambda, DbExpression input, DbExpressionBinding& binding)
at: System.Data.Objects.ELinq.ExpressionConverter.MethodCallTranslator.OneLambdaTranslator.Translate(ExpressionConverter parent, MethodCallExpression call, DbExpression& source, DbExpressionBinding& sourceBinding, DbExpression& lambda)
at: System.Data.Objects.ELinq.ExpressionConverter.MethodCallTranslator.OneLambdaTranslator.Translate(ExpressionConverter parent, MethodCallExpression call)
at: System.Data.Objects.ELinq.ExpressionConverter.MethodCallTranslator.SequenceMethodTranslator.Translate(ExpressionConverter parent, MethodCallExpression call, SequenceMethod sequenceMethod)
at: System.Data.Objects.ELinq.ExpressionConverter.MethodCallTranslator.TypedTranslate(ExpressionConverter parent, MethodCallExpression linq)
at: System.Data.Objects.ELinq.ExpressionConverter.TypedTranslator`1.Translate(ExpressionConverter parent, Expression linq)
at: System.Data.Objects.ELinq.ExpressionConverter.TranslateExpression(Expression linq)
at: System.Data.Objects.ELinq.ExpressionConverter.MethodCallTranslator.OneLambdaTranslator.Translate(ExpressionConverter parent, MethodCallExpression call, DbExpression& source, DbExpressionBinding& sourceBinding, DbExpression& lambda)
at: System.Data.Objects.ELinq.ExpressionConverter.MethodCallTranslator.SelectTranslator.Translate(ExpressionConverter parent, MethodCallExpression call)
at: System.Data.Objects.ELinq.ExpressionConverter.MethodCallTranslator.SequenceMethodTranslator.Translate(ExpressionConverter parent, MethodCallExpression call, SequenceMethod sequenceMethod)
at: System.Data.Objects.ELinq.ExpressionConverter.MethodCallTranslator.TypedTranslate(ExpressionConverter parent, MethodCallExpression linq)
at: System.Data.Objects.ELinq.ExpressionConverter.TypedTranslator`1.Translate(ExpressionConverter parent, Expression linq)
at: System.Data.Objects.ELinq.ExpressionConverter.TranslateExpression(Expression linq)
at: System.Data.Objects.ELinq.ExpressionConverter.Convert()
at: System.Data.Objects.ELinq.ELinqQueryState.GetExecutionPlan(Nullable`1 forMergeOption)
at: System.Data.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption)
at: System.Data.Objects.ObjectQuery`1.System.Collections.Generic.IEnumerable<T>.GetEnumerator()
at: System.Data.Entity.Internal.Linq.InternalQuery`1.GetEnumerator()
at: System.Data.Entity.Infrastructure.DbQuery`1.System.Collections.Generic.IEnumerable<TResult>.GetEnumerator()
at: System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at: System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at: InfoService.GetIDS(String ids) at: InfoService.svc.cs, line: 507
at: System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
at: System.RuntimeMethodHandle.InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
at: System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at: System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at: System.Data.Services.Providers.BaseServiceProvider.InvokeServiceOperation(ServiceOperation serviceOperation, Object[] parameters)
at: System.Data.Services.Providers.EntityFrameworkDataServiceProvider.InvokeServiceOperation(ServiceOperation serviceOperation, Object[] parameters)
at: System.Data.Services.Providers.DataServiceProviderWrapper.InvokeServiceOperation(OperationWrapper serviceOperation, Object[] parameters)
at: System.Data.Services.RequestUriProcessor.ComposeExpressionForServiceOperation(SegmentInfo segment, IDataService service, Boolean checkRights, SegmentInfo lastSegment)
at: System.Data.Services.RequestUriProcessor.ComposeExpressionForSegments(ICollection`1 parsedSegments, IDataService service)
at: System.Data.Services.RequestUriProcessor.ProcessRequestUri(Uri absoluteRequestUri, IDataService service, Boolean internalQuery)
at: System.Data.Services.DataService`1.ProcessIncomingRequestUri()
at: System.Data.Services.DataService`1.HandleRequest()
EF4 が Contains をサポートしていることを知りました。これに対する回避策を作成するにはどうすればよいですか?