Делаю самый простой консольный проект, что бы посмотреть как работать с SQLite.
Добавляю из Nuget пакет System.Data.SQLite (x86/x64), который автоматом тянет EF6 и Linq для него. Создаю простейший код для тестирования.
public class Human
{
[Key]
public Int64 ID { get; set; }
public String Name { get; set; }
}
public class HContext : DbContext
{
public HContext() : base("mydb") { }
public DbSet<Human> Humans { get; set; }
}
class Program
{
static void Main(string[] args)
{
HContext ctx = new HContext();
ctx.Humans.Add(new Human() { ID = 1, Name = "Patrik" });
ctx.SaveChanges();
}
}
Отлично, все работает и запускается, но база создается в каталоге %UserProfile%. Добавляю в файл конфигурации connectionString, что бы база создавалась в директории приложения и получаю ошибку.
<connectionStrings>
<add name="mydb" connectionString="data source =.\mydb.sqlite;" providerName="System.Data.SqlClient"/>
</connectionStrings>
Additional information: An error occurred while getting provider information from the database. This can be caused by Entity Framework using an incorrect connection string. Check the inner exceptions for details and ensure that the connection string is correct.
Пробовал другие варианты, эффект тот же, поисковики молчат как партизаны. В связи с этим вопрос, как правильно прописать connectionString?
UPD
Так же в файле конфигурации есть System.Data.SQLite.EF6. Но при попытке подключить его в connectionString получаю такую ошибку.
Additional information: Unable to determine the provider name for provider factory of type 'System.Data.SQLite.SQLiteFactory'. Make sure that the ADO.NET provider is installed or registered in the application config.