在 Linq .DBML 文件中重构表名和列名的简单方法?
我最近对数据库 (SQL Server) 中的列和表的名称进行了大量更改。现在我需要更新 Linq to SQL 模型 (.DBML) 文件以反映这一点。
过去当我这样做时;我通常手动重命名列/表,然后必须遍历代码中的所有实例并相应地重命名。然而,正如您可以想象的那样,这非常麻烦。
有没有一种更简单的方法来重构 .DBML 中的名称,类似于 “右键单击 -> 重构 -> 重命名”但是对于 .DBML 文件?
I've recently made a large series of changes to the names of columns and tables within our database (SQL Server). Now I need to update the Linq to SQL Model (.DBML) file to reflect this.
In the past when I've done this; I usually manually rename the column / table then have to go through all instances in the code and rename accordingly. However this is pretty cumbersome as you can imagine.
Is there an easier way to refactor names in .DBML, something along the lines of
"Right Click -> Refactor -> Rename" but for a .DBML file?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这正是我在项目中选择不使用dbml方式实现LINQ 2 SQL的原因。相反,我自己定义了类,并使用属性映射到表和列。我知道这需要做很多工作。但它是值得的..
一个例子:
This is exactly the reason I chose not to use the dbml way to implement LINQ 2 SQL in my project. I instead defined the classes myself and mapped to tables and columns using attributes.. I know its a lot work. but its worth it..
An example:
DBML 没有“刷新”按钮。我通常会删除所有内容,然后拖动视图和视图。从服务器资源管理器返回的过程。清理后一定要保存 DBML,否则它将保留旧的定义。
That there is no "refresh" button for DBML. I typically remove everything, and then drag the views & procedures back from Server Explorer. Be sure to save the DBML after cleaning it, otherwise it will keep the old definitions.
我为此目的使用了 Huagati DBML 工具,并且发现它工作得非常好。
看看吧,对于单个开发者许可证来说相当便宜。
华加体DBML工具
I have used the Huagati DBML Tools for this very purpose, and found it to work very well.
Check it out, it's pretty cheap for a single developer license.
Huagati DBML Tools