Пытаюсь подружить EF6 и SQLite базу данных. Создал модель и контекст данных.
[Table("JOBS", Schema = "main")]
public class Job
{
[Column("ID")]
public string Id { get; set; }
[Column("NAME")]
public string Name { get; set; }
[Column("ENTRYNUMBER")]
public int EntryNumber { get; set; }
[Column("TIME")]
public int Time { get; set; }
[Column("WORKFLOWENTRYNUMBER")]
public int WorkflowEntryNumber { get; set; }
[Column("FOLDERENTRYNUMBER")]
public int FolderEntryNumber { get; set; }
[Column("ISFAILED")]
public int IsFailed { get; set; }
[Column("ISCOPIED")]
public int IsCopied { get; set; }
[Column("DURATION")]
public int Duration { get; set; }
[Column("PROCESSDURATION")]
public int ProcessDuration { get; set; }
[Column("PRIORITY")]
public int Priority { get; set; }
[Column("TOTALCHARACTERS")]
public int TotalCharacters { get; set; }
[Column("UNCERTAINCHARACTERS")]
public int UncertainCharacters { get; set; }
[Column("PAGESAREA")]
public int PagesArea { get; set; }
[Column("USERNAME")]
public string UserName { get; set; }
}
public class Context:DbContext
{
public Context():base("DefaultConnection")
{
}
public DbSet<Job> Jobs { get; set; }
}
Вот app.config:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
</configSections>
<connectionStrings>
<add name="DefaultConnection" connectionString="Data Source=C:\ProgramData\ABBYY Recognition Server 4.0\RS4WF\Jobs\JobsLog\temp\JobsLogTable.db" providerName="System.Data.SQLite" />
</connectionStrings>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
<providers>
<provider invariantName="System.Data.SQLite" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6"/>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
<provider invariantName="System.Data.SQLite.EF6" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6" />
</providers>
</entityFramework>
<system.data>
<DbProviderFactories>
<add name="SQLite Data Provider (Entity Framework 6)" invariant="System.Data.SQLite.EF6" description=".NET Framework Data Provider for SQLite (Entity Framework 6)" type="System.Data.SQLite.EF6.SQLiteProviderFactory, System.Data.SQLite.EF6" />
<add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".NET Framework Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" />
</DbProviderFactories>
</system.data>
</configuration>
В итоге при попытке загрузить объекты получаю пустую коллекцию, хотя база данных заполнена.
var db = new Context();
db.Jobs.Load();
var jobs=db.Jobs.Local.ToList();
Вот начало Проблемы с EntityFramework+SQLite
Data Source=
? Я так помню должно бытьFilename=
Read Only=True;FailIfMissing=True;