Is there an in-memory provider for Entity Framework?

前端 未结 8 2322
情书的邮戳
情书的邮戳 2020-12-05 22:42

I am unit testing code written against the ADO .NET Entity Framework. I would like to populate an in-memory database with rows, and make sure that my code retrieves them pro

8条回答
  •  庸人自扰
    2020-12-05 23:14

    Yes, there is at least one such provider - SQLite. I have used it a bit and it works. Also you can try SQL Server Compact. It's an embeded database and has EF providers too.
    Edit:
    SQLite has support for in-memory databases (link1). All you need is to specify a connection string like: "Data Source=:memory:;Version=3;New=True;". If you need in an example you may look at SharpArchitecture.

提交回复
热议问题