My project (asp.mvc UI layer) was developed using .NET 3.5. After upgrading to .NET 4.0, I had a problem with compiled queries:
[ArgumentException: Query was compiled for a different mapping source than the one associated with the specified DataContext.] System.Data.Linq.CompiledQuery.ExecuteQuery(DataContext context, Object[] args) +863348 System.Data.Linq.CompiledQuery.Invoke(TArg0 arg0, TArg1 arg1) +110
Every time I run my request, I pass in my context
return StaticQueries.getTopFiveOrders(mContext, int howMany); public static Func<Mycontext, int, IQueryable<Order>> getTopFiveOrders = CompiledQuery.Compile ((Mycontext mContext, int howMany) => ( some query).Distinct());
The error occurs in the second request.
marcinn
source share