在向DEV中的数据库表添加新列之后,我更新了我的dbml文件。一切都在DEV环境中工作。但是当部署到测试和生产时,我得到了这个无效的列名称异常。有什么建议吗?
HTTP client
更新:添加日志:
2015-12-01 09:59:04,267 [29]错误 [BusinessLogic.Managers.EntityManagers.IntegrationManager.Run] An 在调用bla bla期间发生错误
异常消息:列名称'MyNewAddedColumn'无效。
堆栈跟踪:在System.Data.SqlClient.SqlConnection.OnError(SqlException异常, Boolean breakConnection,Action
var CreateUpdateCtx = new MyDataContext(connectionstring); var Data = vutTable.Accounts.ToList(); //Calling ToList() results in the exception shown below
1完成,Int32超时,Task&任务, 布尔asyncWrite)at System.Data.SqlClient.SqlCommand.RunExecuteReader(的CommandBehavior cmdBehavior,RunBehavior runBehavior,Boolean returnStream,String 方法)at System.Data.SqlClient.SqlCommand.ExecuteReader(的CommandBehavior 行为,String方法)at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(的CommandBehavior 行为) System.Data.Linq.SqlClient.SqlProvider.Execute(表达式查询, QueryInfo queryInfo,IObjectReaderFactory factory,Object [] parentArgs,Object [] userArgs,ICompiledSubQuery [] subQueries,Object lastResult)at System.Data.Linq.SqlClient.SqlProvider.ExecuteAll(表达式查询, QueryInfo [] queryInfos,IObjectReaderFactory factory,Object [] userArguments,ICompiledSubQuery [] subQueries)at System.Data.Linq.SqlClient.SqlProvider.System.Data.Linq.Provider.IProvider.Execute(表达式 查询)在System.Data.Linq.Table1 wrapCloseInAction) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData() at System.Data.SqlClient.SqlDataReader.get_MetaData() at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, SqlDataReader ds) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource
1..ctor(IEnumerable1.GetEnumerator() at System.Collections.Generic.List
1 source)at at BusinessLogic.Managers.Integration.syncTable [T1,T2](IList1 collection)
1 TableToUpdate)at at BusinessLogic.Managers.Integration.Execute()at BusinessLogic.Managers.EntityManagers.IntegrationManager.execute()
at System.Linq.Enumerable.ToList[TSource](IEnumerable
答案 0 :(得分:0)
看起来您没有将数据库更改从本地数据库或较低环境数据库移动到生产数据库。请验证。
因此,当您在dev中运行Linq2SQL时,它正在工作,因为本地或dev数据库中存在新列。但是在生产中,DBML尝试从Accounts表中的新列中检索该值,但它不存在并导致上述错误