用于特定表的 SQL Metal 或刷新/将表添加到 .dbml 文件的其他方式
任何人都可以在 Visual Studio 中轻松执行此操作,而无需使用服务器资源管理器?
我也尝试查看宏,但记录只产生
Sub TemporaryMacro()
End Sub
所以没有运气。
有什么办法编写这个脚本吗?
anybody have any easy way of doing this in Visual Studio, without having to use the Server Explorer ?
I tried also looking at macro's but recording only produce
Sub TemporaryMacro()
End Sub
So no luck there.
Any way to script this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我正在使用与此类似的批处理脚本来在基础表/视图更改时管理模型的更新。要使用它:
生成.bat:
selectedEntities.txt 示例:
说明:
I am using a batch script similar to this to manage the updating of my models when the underlying tables/views change. To use it:
Generate.bat:
chosenEntities.txt example:
Explanation:
SqlMetal Include 对我来说就像一个魅力。
首先使用 SqlMeta 创建一个完整的 dbml 文件 - 说 testComplete.dbml
现在提供此文件作为 SqlMetaInclude 的输入
SqlMetalIninclude /dbml:"testComplete.dbml" /output:"testSubSet.dbml" /include:dbo.SampleTable1=SampleTable1,dbo.SampleTable2=SampleTable2
请注意,此工具包含一个可以处理完整过程的 GUI。
SqlMetal Include worked like a charm for me.
First Create a complete dbml file using SqlMeta - Say testComplete.dbml
Now provide this file as an input to SqlMetaInclude
SqlMetalInclude /dbml:"testComplete.dbml" /output:"testSubSet.dbml" /include:dbo.SampleTable1=SampleTable1,dbo.SampleTable2=SampleTable2
Note that this tool in has a GUI included which can handle the complete process.
有一个很好的实用程序可以帮助您从数据库更新现有的 DBML 文件:Huagati DBML/EDMX 工具< /a>.
它不是免费的,但对于任何严肃的 Linq-to-SQL 开发来说都值得投资。
唯一的选择是自己编写 - 读取数据库结构并将其与 DBML 中的 XML 表示进行比较,并根据需要更新 DBML。
There is one good utility out there which helps you update your existing DBML files from the database: Huagati DBML/EDMX tools.
It's not free, but worth the investment for any serious Linq-to-SQL development.
The only alternative would be to write it yourself - read the database structure and compare that to the XML representation in the DBML, and update the DBML as needed.