Ticket Hash: | 7eba26f7e4920ae374428e3d00667a646613f6b5 | |||
Title: | SetProviderFactory method can't use in x86 .NET 4.0 | |||
Status: | Closed | Type: | Build_Problem | |
Severity: | Important | Priority: | Medium | |
Subsystem: | None | Resolution: | Open | |
Last Modified: | 2015-08-30 17:36:14 | |||
Version Found In: | 1.0.98.0 | |||
User Comments: | ||||
anonymous added on 2015-08-30 16:56:32:
Normally we add some messages in config files. for example: <entityFramework> <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework"> <parameters> <parameter value="v12.0"/> </parameters> </defaultConnectionFactory> <providers> <provider invariantName="System.Data.SQLite.EF6" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6"/> </providers> </entityFramework> I search some message tell me I can use this way add it in code: public class SQLiteConfiguration : DbConfiguration { public SQLiteConfiguration() { SetProviderFactory("System.Data.SQLite", System.Data.SQLite.SQLiteFactory.Instance); SetProviderFactory("System.Data.SQLite.EF6", SQLiteProviderFactory.Instance); SetProviderServices("System.Data.SQLite", (DbProviderServices)SQLiteProviderFactory.Instance.GetService(typeof(DbProviderServices))); } } Then add this class to DbContext head as a Attribute: [DbConfigurationType(typeof(SQLiteConfiguration))] I'm using vs2013, So I install x86 .net4.5.1 vs2013.msi. After generate my model. I reference .net4 x86 version System.Data.SQLite.dll (I'm very tired of this, but no other way, my project need use .net4 version System.Data.SQLite) Then when I build my project it tell me, my model project has some references with .net4.5.1, then I throw exception, build failed. After I remove SetProviderFactory method. All fine. So How do I fixed that? Or can you tell me how do I manually add that config field use code. Thank you very much anonymous added on 2015-08-30 17:36:14: problem solved, I just need let System.Data.SQLite set to copy to local. Looks like 2 .net version has Conflict. Sorry for that. |