Search code examples
entity-frameworkvisual-studiosqliteef-database-first

What's the quickest way to generate Entity Framework model code given an SQLite database?


I've got an SQLite database defined by an SQL DDL (CREATE TABLE etc.) script and am to derive Entity Framework model classes to work with it.

In the past, when I had an opportunity to try Visual Studio 2013 Ultimate and Microsoft SQL Server in the same situation, Visual Studio allowed me to use "database-first" approach and reverse-engineer the model to create the model classes automatically. But I can't find anything like that available in Visual Studio 2015 Community and SQLite.

Am I missing something or are there, perhaps, 3-rd party tools that can do the job to set me free of mechanically typing all the model code manually?


Solution

  • If you use VS Express you are out of luck, since you cannot install DDEX providers or any other extensions using that edition. Use Community, the download sqlite-netFx46-setup-bundle-x86-2015-1.0.104.0.exe from http://system.data.sqlite.org/index.html/doc/trunk/www/downloads.wiki (see my blogpost here for detailed info: http://erikej.blogspot.dk/2014/11/using-sqlite-with-entity-framework-6.html )

    If you use EF Core, upgrade to Community, and install the latest daily of my VS extension SQLite Toolbox, which has a feature to generate an EF Core Model via GUI https://github.com/ErikEJ/SqlCeToolbox/wiki/Release-notes