wanlitao / HangfireExtension

Hangfire Extension plugins
Apache License 2.0
22 stars 32 forks source link

Encrypted support in .Net Standard 2.0 with .Net Framework 4.8 #31

Closed khurana87 closed 2 years ago

khurana87 commented 4 years ago

I am using sqlite in .Net standard 2.0 with .Net framework 4.8 so I added all dll through nuget.

string connectionString = "Data Source="C:\Program Data\sampleproject.db;Password=p123".

In first case: System.Data.Sqlite,System.Data.sqlite.core, system.data.sqlite.linq. While passing datasource path with password. It gives exception while opening a Sqliteconnection: "SQL logic error Cannot use "Password" connection string property: library was not built with encryption support, please see "https://www.sqlite.org/see" for more information". so I added sqlitepcl.raw, sqlitepclraw.core. No change in result I got same exception.

In second scenario, in fresh way to add dll. I added dll : sqlite-net-base, sqlite-net-sqlcipher, sqlitepclraw.bundle.e-sqlite3, sqlitepclraw.core. In this case, I tried to call connection with Sqliteasyncconnection and sqliteconnection. Both times exception says: "You need to call SQLitePCL.raw.SetProvider(). If you are using a bundle package, this is done by calling SQLitePCL.Batteries.Init()".

In third sceanrio, I used Microsoft.data.sqlite.core and sqlitepclraw.bundle_e_sqlcipher according to "https://docs.microsoft.com/en-us/dotnet/standard/data/sqlite/encryption?tabs=netcore-cli". I am getting exception while creating connection. "The process has no package identity. (Exception from HRESULT: 0x80073D54)".

Which scenario will suit to allow me password encrypted db file to create and connect. What modification required. Thanks in advance.