I have been trying Browse a sqlite db file and read data using Entity framework . But following way does not work I am initiating the MydbContext with sqlite file path eg
using (var sourceContext = new MydbContext(@"D:\test\data.sqlite"))
{
var a= sourceContext.MyModel.ToList();
}
public MydbContext(string path)
: base(GetConnectionString(path))
{
Configuration.LazyLoadingEnabled = false;
}
public static string GetConnectionString(string path)
{
var entityConnectionString = new EntityConnectionStringBuilder
{
Metadata = "res://*",
Provider = "System.Data.SQLite.EF6",
ProviderConnectionString = sqlLiteConnectionString,
}.ConnectionString;
}
Please suggest if there is a proper way to achieve this using sqlite and ef.