开发者

DataContext to DB

开发者 https://www.devze.com 2023-01-03 23:15 出处:网络
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?

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

0

精彩评论

暂无评论...
验证码 换一张
取 消