views:

474

answers:

2

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?

+4  A: 

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.

Andrew Robinson
+2  A: 

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...

valhallasw