DataContext to DB
I have designed my DB using the ORM in VS 2008.
What is 开发者_如何学Cthe best way to export this to an SQL server so it will create the tables and relations on SQL Server?
Thanks,
JD
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.
See: Export DBML to SQL script
精彩评论