tags:

views:

26

answers:

2
+1  Q: 

DataContext to DB

Hi all,

I have designed my DB using the ORM in VS 2008.

What is the best way to export this to an SQL server so it will create the tables and relations on SQL Server?

Thanks,

JD

+1  A: 

See: Export DBML to SQL script

Reddog
I took the liberty of assuming you meant the LINQ to SQL ORM rather than LINQ to Entities.
Reddog
Entity Framework
RobS
@RobS - Right you are - woops, totally wrong terminology there!
Reddog
@Reddog - Perception wise, there isn't much difference between "Entity Framework" and "Linq To Entities".
Michael Maddox
True at that...
RobS
+4  A: 

If you are using the LINQ-to-SQL, then:

var(dc = new MyDataContext()) {
    dc.CreateDatabase();
}

should do it, but only if you have all the required data. To be honest, it works better starting from tables (perhaps in SSMS) and dragging them into LINQ-to-SQL.

Also; there are a lot of important database concepts (indexing, etc) that is not expressed in DBML.

Marc Gravell