【发布时间】:2012-07-20 15:50:52
【问题描述】:
我正在尝试查找仅出现在某些客户端计算机上的错误,当然我们无法在内部重现该错误。抛出的InnerException 是
SQLite 错误没有这样的列:Extent1.UserDefinedPid
找不到的列是SQLite数据库中这样定义的位域:
[UserDefinedPid] bit NOT NULL DEFAULT 0
EDMX 文件包含这个定义(只是部分内容):
<EntityType Name="Parameter">
<Key>
<PropertyRef Name="ParameterID" />
</Key>
<Property Type="Int64" Name="ParameterID" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
...
<Property Type="Boolean" Name="UserDefinedPid" Nullable="false" />
...
</EntityType>
我们已经确认了相同的 SQLite 数据库文件,并且正在加载正确的 System.Data.SQLite 和 System.Data.SQLite.Linq dll,但由于某些奇怪的原因,一些机器似乎认为此列丢失了。
我们使用的数据库是加密的,我们有一个应用程序的 app.config 文件,以确保 SQLite 的其他安装不会干扰应用程序。
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections></configSections>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" />
</startup>
<system.data>
<DbProviderFactories>
<remove invariant="System.Data.SQLite" />
<add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".Net Framework Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" />
</DbProviderFactories>
</system.data>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Data.SQLite" culture="neutral" publicKeyToken="db937bc2d44ff139" />
<bindingRedirect oldVersion="1.0.0.0 - 2.0.0.0" newVersion="1.0.66.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
我不知道为什么这在某些机器上会失败。任何想法都非常感谢:-)
【问题讨论】:
-
列的名称是什么?任何有趣的事情,例如它是否包含重音字符?
-
@JonSkeet 在某些机器上抛出错误的列的名称是 UserDefinedPid。除了它在某些机器上失败但在其他机器上失败之外,没有什么特别有趣的。有问题的机器正在运行 Windows 7 Professional SP1 64bit。
标签: c# linq entity-framework sqlite