2012-07-20 82 views
3

我想追查只出現在一些客戶端機器上的錯誤,當然我們不能在內部重現錯誤。引發的InnerExceptionSQLite錯誤沒有這樣的列使用實體框架

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.SQLiteSystem.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> 

我不知道爲什麼這在某些機器上失敗。任何想法都不勝感激:-)

+0

列的名稱是什麼?任何有趣的事情,例如它是否包含重音字符? – 2012-07-20 15:53:38

+0

@JonSkeet在某些機器上拋出錯誤的列的名稱是UserDefinedPid。沒有什麼特別有趣的,除了它在某些機器上失敗,而在其他機器上失敗的事實。有問題的機器正在運行Windows 7 Professional SP1 64位。 – 2012-07-20 17:52:38

回答

0

我強烈懷疑您正在使用System.Data.SQLite的quite old version

也許你可以試試找到最新版本here

一旦你這樣做,app.config文件將不再被需要這樣的:

<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> 

我有點不清楚加密擔憂你提到。您是使用提供給SQLiteConnection連接對象的密碼進行加密的,還是使用SEE extension

+0

我們使用的版本是1.0.66.0,從2010年4月開始。我們嘗試在問題計算機上使用最新的版本1.0.81.0,但它立即崩潰,根本無法打開連接(認爲加載數據時出錯提供商)。我們在數據庫上使用RSA加密來保護我們的IP。對加密沒有擔心,但如果有機會可能導致問題,我想確保我注意到這一事實。 – 2012-07-20 19:12:35

+0

@BrianWenhold:我認爲這是爲了解決新版本的問題,並在進一步處理您現在遇到的問題之前使用它。如果需要的話,也許開始一個新的問題。 – 2012-07-22 18:18:57