linq.compiledquery

DataContext compiled query problem with .NET 4

核能气质少年 提交于 2019-12-08 19:48:01
问题 My project (UI layer is asp.mvc) was developed using .NET 3.5. After upgrading to .NET 4.0 I have got 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 when I run my query I am passing my context return StaticQueries

Compiled queries and “Parameters cannot be sequences”

倾然丶 夕夏残阳落幕 提交于 2019-12-08 17:34:21
问题 I thought that compiled queries would perform the same query translation as DataContext. Yet I'm getting a run-time error when I try to use a query with a .Contains method call. Where have I gone wrong? //private member which holds a compiled query. Func<DataAccess.DataClasses1DataContext, List<int>, List<DataAccess.TestRecord>> compiledFiftyRecordQuery = System.Data.Linq.CompiledQuery.Compile <DataAccess.DataClasses1DataContext, List<int>, List<DataAccess.TestRecord>> ((dc, ids) => dc