Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to update a sql database schema from an edmx in Visual Studio 2008?

So with LINQ-to-SQL I know you can update the database from the LINQ objects and update the LINQ objects from the SQL.

I am using LINQ's entity framework (a.k.a. LINQ-to-entities) and I can update the entities from the SQL database, but I can't update the database schema by changing the entities.

This is frustrating. Is there something I am missing? Am I doing something wrong? If this is not possible with Visual Studio 2008 is there a plug-in or other 3rd party application that will do this?

like image 657
Phobis Avatar asked Mar 28 '09 01:03

Phobis


2 Answers

Right now the EF model can only be generated from the database. The database cannot be generated from the model.

Something that is talked about for future versions.

like image 105
andleer Avatar answered Sep 23 '22 14:09

andleer


I have been working on extending the LINQ to SQL Database Sync(*) (csdb.exe) tool to work with edmx files. For now, I have got a preliminary, but working, version that can generate and update tables in your database. Relations are not working yet, and you will probably run into some other issues. The code is available on github, under the Ms-PL (as was the original csdb.exe).

Please note the database connection string and edmx filename are hardcoded for now. This is my prototyping version, not a release one ;)

(*) Please google the original tool. Stack Overflow does not allow me to post more than one link...

like image 29
valhallasw Avatar answered Sep 22 '22 14:09

valhallasw