jjzjj

ServiceCustomContext

全部标签

c# - 编译查询失败 - 查询是针对与指定 DataContext 关联的映射源不同的映射源编译的

我有以下代码用于编译的Linq2sql查询以计算表中的行数。尽管相同的未编译查询运行顺利,但查询抛出异常:publicstaticFuncCompiledCount=CompiledQuery.Compile((ServiceCustomContextdb)=>db.Current.Count());publicstaticintCount(){using(ServiceCustomContextdb=newServiceCustomContext(Constants.NewSqlConnection))returnCompiledCount(db);}ServiceCustomCon