创建EF上下文时的异常

时间:2018-06-28 06:16:26

标签: c# database entity-framework exception

我正在编写一个使用EF6(代码优先)作为ORM的自动测量应用程序。该应用程序使用两个Db。从我们的ERP系统中读取一个Db是一个遗留的东西,在其中读取产品和过程数据。另一个是由我的应用创建的,用于存储和检索测量值等。

我在个人PC中开发了该应用程序,并复制了LocalDb中的原始旧版Db。我没有在本地副本中修改旧版Db,而是通过EF在我的应用程序中修改了创建的模型,以添加诸如EF不会自动创建的自引用父子关系之类的东西,并更改了某些实体名称对于前。 Proc-到Processes的表。

该应用程序将在我公司的不同计算机上运行。

现在,当在公司的PC中运行该应用程序时,它的工作方式应该像它应该的那样,但是我注意到在输出窗口中出现了这些异常。就像我说的那样,该应用程序可以正常运行,但是我仍然想知道为什么会这样。

我已经阅读了很多东西,而且我读到如果我的模型和数据库之间存在一些不同步,这可能会发生吗?这是否意味着我不应该添加这些“自定义”关系?还是与此无关?

调试输出

Exception thrown: 'System.Data.SqlClient.SqlException' in System.Data.dll
Exception thrown: 'System.Data.SqlClient.SqlException' in System.Data.dll
Exception thrown: 'System.Data.SqlClient.SqlException' in System.Data.dll
Exception thrown: 'System.Data.SqlClient.SqlException' in System.Data.dll
Exception thrown: 'System.Data.Entity.Core.EntityCommandExecutionException' in EntityFramework.dll
Exception thrown: 'System.Data.Entity.Core.EntityCommandExecutionException' in EntityFramework.dll
Exception thrown: 'System.Data.Entity.Core.EntityCommandExecutionException' in EntityFramework.dll
Exception thrown: 'System.Data.Entity.Core.EntityCommandExecutionException' in EntityFramework.SqlServer.dll
Exception thrown: 'System.Data.SqlClient.SqlException' in System.Data.dll
Exception thrown: 'System.Data.SqlClient.SqlException' in System.Data.dll
Exception thrown: 'System.Data.SqlClient.SqlException' in System.Data.dll
Exception thrown: 'System.Data.SqlClient.SqlException' in System.Data.dll
Exception thrown: 'System.Data.Entity.Core.EntityCommandExecutionException' in EntityFramework.dll
Exception thrown: 'System.Data.Entity.Core.EntityCommandExecutionException' in EntityFramework.dll
Exception thrown: 'System.Data.Entity.Core.EntityCommandExecutionException' in EntityFramework.dll
Exception thrown: 'System.Data.Entity.Core.EntityCommandExecutionException' in EntityFramework.SqlServer.dll
'MultiMess.exe' (CLR v4.0.30319: MultiMess.exe): Loaded 'EntityFrameworkDynamicProxies-EntityFramework'. 
Exception thrown: 'System.Data.SqlClient.SqlException' in System.Data.dll
Exception thrown: 'System.Data.SqlClient.SqlException' in System.Data.dll
Exception thrown: 'System.Data.SqlClient.SqlException' in System.Data.dll
Exception thrown: 'System.Data.SqlClient.SqlException' in System.Data.dll
Exception thrown: 'System.Data.Entity.Core.EntityCommandExecutionException' in EntityFramework.dll
Exception thrown: 'System.Data.Entity.Core.EntityCommandExecutionException' in EntityFramework.dll
Exception thrown: 'System.Data.Entity.Core.EntityCommandExecutionException' in EntityFramework.dll
Exception thrown: 'System.Data.Entity.Core.EntityCommandExecutionException' in EntityFramework.SqlServer.dll
'Hengesbach.MultiMess.exe' (CLR v4.0.30319: Hengesbach.MultiMess.exe): Loaded 'EntityFrameworkDynamicProxies-T4DataAccess'. 
'Hengesbach.MultiMess.exe' (CLR v4.0.30319: Hengesbach.MultiMess.exe): Loaded 'C:\Users\VR\Documents\Repositories\Hengesbach.MultiMessCS\Hengesbach.MultiMess\bin\Debug\Hengesbach.MultiMess.Data.dll'. Symbols loaded.
'Hengesbach.MultiMess.exe' (CLR v4.0.30319: Hengesbach.MultiMess.exe): Loaded 'C:\Users\VR\Documents\Repositories\Hengesbach.MultiMessCS\Hengesbach.MultiMess\bin\Debug\Matterhook.NET.MatterhookClient.dll'. Cannot find or open the PDB file.
'Hengesbach.MultiMess.exe' (CLR v4.0.30319: Hengesbach.MultiMess.exe): Loaded 'C:\Users\VR\Documents\Repositories\Hengesbach.MultiMessCS\Hengesbach.MultiMess\bin\Debug\System.Net.Http.dll'. Cannot find or open the PDB file.
Exception thrown: 'System.Data.SqlClient.SqlException' in System.Data.dll
Exception thrown: 'System.Data.SqlClient.SqlException' in System.Data.dll
Exception thrown: 'System.Data.SqlClient.SqlException' in System.Data.dll
Exception thrown: 'System.Data.SqlClient.SqlException' in System.Data.dll
Exception thrown: 'System.Data.SqlClient.SqlException' in EntityFramework.dll
Exception thrown: 'System.Data.Entity.Core.EntityCommandExecutionException' in EntityFramework.dll
Exception thrown: 'System.Data.Entity.Core.EntityCommandExecutionException' in EntityFramework.dll
Exception thrown: 'System.Data.Entity.Core.EntityCommandExecutionException' in EntityFramework.dll
Exception thrown: 'System.Data.Entity.Core.EntityCommandExecutionException' in EntityFramework.SqlServer.dll
Exception thrown: 'System.Data.SqlClient.SqlException' in System.Data.dll
Exception thrown: 'System.Data.SqlClient.SqlException' in System.Data.dll
Exception thrown: 'System.Data.SqlClient.SqlException' in System.Data.dll
Exception thrown: 'System.Data.SqlClient.SqlException' in System.Data.dll
Exception thrown: 'System.Data.SqlClient.SqlException' in EntityFramework.dll
Exception thrown: 'System.Data.Entity.Core.EntityCommandExecutionException' in EntityFramework.dll
Exception thrown: 'System.Data.Entity.Core.EntityCommandExecutionException' in EntityFramework.dll
Exception thrown: 'System.Data.Entity.Core.EntityCommandExecutionException' in EntityFramework.dll
Exception thrown: 'System.Data.Entity.Core.EntityCommandExecutionException' in EntityFramework.SqlServer.dll
Exception thrown: 'System.Data.SqlClient.SqlException' in System.Data.dll
Exception thrown: 'System.Data.SqlClient.SqlException' in System.Data.dll
Exception thrown: 'System.Data.SqlClient.SqlException' in System.Data.dll
Exception thrown: 'System.Data.SqlClient.SqlException' in System.Data.dll
Exception thrown: 'System.Data.SqlClient.SqlException' in EntityFramework.dll
Exception thrown: 'System.Data.Entity.Core.EntityCommandExecutionException' in EntityFramework.dll
Exception thrown: 'System.Data.Entity.Core.EntityCommandExecutionException' in EntityFramework.dll
Exception thrown: 'System.Data.Entity.Core.EntityCommandExecutionException' in EntityFramework.dll
Exception thrown: 'System.Data.Entity.Core.EntityCommandExecutionException' in EntityFramework.SqlServer.dll

仅出于信息目的,该应用程序用来访问旧版DB的用户仅具有读取权限。应用数据库的用户是该数据库的所有者,因此拥有全部权利。

0 个答案:

没有答案