数据库架构更改后更新LINQ to SQL类最佳途径 [英] Best way to update LINQ to SQL classes after database schema change
本文介绍了数据库架构更改后更新LINQ to SQL类最佳途径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用LINQ to SQL类项目中,其中数据库的设计还是有些变动的。
I'm using LINQ to SQL classes in a project where the database design is still in a bit of flux.
是否与该模式同步类的一个简单的方法,或是否需要手动更新的类,如果表设计更改?
Is there an easy way of synchronising the classes with the schema, or do I need to manually update the classes if a table design changes?
推荐答案
您可以使用SQLMetal.exe生成您的dbml和或CS / VB文件。使用pre-构建脚本来启动和目标在您的DataContext项目属于该目录。
You can use SQLMetal.exe to generate your dbml and or cs/vb file. Use a pre-build script to start it and target the directory where your datacontext project belongs.
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin\x64\sqlmetal.exe
/server:<SERVER>
/database:<database>
/code:"path\Solution\DataContextProject\dbContext.cs"
/language:csharp
/namespace:<your namespace>
这篇关于数据库架构更改后更新LINQ to SQL类最佳途径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文