Hi everyone,

I’m having a hard time getting Entity Framework 6 to work with a password 
encrypted file. I’ve tried several things the last few days and just cannot get 
it to work, I always get an error stating that the file is encrypted. My 
connection string with a password looks like this:

<add name="ASAuditDBEntities" 
connectionString="metadata=res://*/ASAuditDB.csdl|res://*/ASAuditDB.ssdl|res://*/ASAuditDB.msl;provider=System.Data.SQLite.EF6;provider
 connection string=&quot;data 
source=|DataDirectory|\ASAuditDB.db;password=mypassword&quot;" 
providerName="System.Data.EntityClient" />

That was generated using the ADO.net database first designer. I’ve also tried 
using the ADO database first provider to read the encrypted database and that 
didn’t work either. The test button works when I enter the password but the 
model won’t generate. I’ve also tried including the version number in the 
connection string, same error.

I’ve tried using the context constructor to pass in a SQLite connection instead 
of the default dbConnection. That always tries to throw me into an 
onModelCreated event. That looked like this:

public ASAuditDBEntities()
            : base(new SQLiteConnection(@"Data 
Source=C:\Altamont\Data\ASAuditDB.db;", false), true)
{
            this.Database.Connection.Open();
            this.Database.Connection.Close();
}

The open and close methods work, but like I said I get an OnModelCreated event 
thrown which keeps me from actually using the database. I’ve also tried using 
the default connection:

public ASAuditDBEntities()
            : base("name=ASAuditDBEntities")
        {
        }

Which gives me the same encryption error. I can cast the default constructor’s 
dbConnection as a SQLiteConnection and set the password, open and close it but 
still get the encryption error. I can also set the password on the above 
connection with the SQLiteConnection constructor and open and close the 
database there as well.

Any ideas?

Thanks for your time!




_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to