View Ticket
Not logged in
Ticket Hash: c8083867b97b8862e81bfd1e4926a3d124c2ee09
Title: Support Entity Framework 4
Status: Closed Type: Feature_Request
Severity: Important Priority: Medium
Subsystem: LINQ Resolution: Overcome_By_Events
Last Modified: 2014-03-11 23:13:20
Version Found In: trunk
SQLite currently does not fully support Entity Framework 4.0, notably the CreateDatabase(), DatabaseExists() and DeleteDatabase() methods in its DbProviderServices, without which it is not possible to initialize the database via "Code First".

If these three methods would work with SQLite, it would be very useful for unit testing, as it is the only database engine that supports pure memory-backed databases (via "Data Source=:memory:"), making it easy to allow unit tests for the DB mapping layer to run in parallel to each other.

anonymous added on 2012-01-26 09:29:47 UTC:
Here's a chunk of example code for EF 4.2 that reproduces the errors:

public class Post {
	public string Title { get; set; }
public class BlogContext : DbContext {
	public BlogContext() : base(nameOrConnectionString: "BlogConnection") { }
	public DbSet<Post> Posts { get; set; }
class Program {
	static void Main(string[] args) {
			new CreateDatabaseIfNotExists<BlogContext>()
		using(var context = new BlogContext()) {
			context.Posts.Add(new Post() { Title = "Test" });

Of course, the appropriate App.config needs to be in place:

<?xml version="1.0" encoding="utf-8" ?>
			<remove invariant="System.Data.SQLite" />
				name="SQLite Data Provider"
				description="Data Provider for SQLite"
				type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite"
			connectionString="Data Source=:memory:"
User Comments:
anonymous (claiming to be morpheus_xx) added on 2013-06-25 05:35:36:

Is there any news about this issue? I plan to use SQLite in a EF4 "Code First" project, but due to this missing feature I can't do so.

During my investigation I found following background:

1) ObjectContext.CreateDatabase is used to create a new database ( It is stated in docs, that: "most work is delegated to:"

2) DbProviderServices.CreateDatabase Method (

3) But there is already a SQLiteProviderServices class that derives from DbProviderServices (

So what else is missing? How much effort it would take to implement the missing features?

I really would like to have a version that works with "Code First" EF feature!

Thank you very much!

anonymous added on 2013-06-28 05:57:40:
Found some more information that may be helpful, the source code can be downloaded

mistachkin added on 2014-03-11 23:13:20:
The Entity Framework 6 is now supported.