从 LINQ-TO-SQL DBML 文件生成表/视图架构
我想要一个数据结构描述的单一来源。
有人问数据库中的DBML文件发生变化时是否可以刷新。我的做法虽然愚蠢但很常见;打开它,删除所有内容,然后再次拖放。 我听说有一些第三者在做这些把戏。
但我在想,有什么办法可以反转操作吗?
在hibernate中,有一种方法可以从XML数据结构构建目标DB的DDL。
DBML文件有可能包含重建数据库DDL的所有信息吗? (例如,拥有这些 VIEW SQL、存储过程代码的副本),并即时构建“创建脚本”(就像您在 SQL Server Enterprise Manager 中所做的那样)
I'd like to have a single source of the description of the data structure.
Some people are asking can the DBML file being refreshed when it is changed in the database. The way I do is stupid but common; open it, delete all, and drag-drop again.
I heard that there are some 3rd party do the tricks.
But I am thinking, any way to inverse the operation?
In hibernate, there is a way to build the DDL of the target DB from the XML data structure.
Is it possible that the DBML file will contain all information to rebuild the DDL of the database? (e.g. have a copy of those VIEW SQL, stored procedure codes), and build the "Create script" on the fly (like what you do in SQL Server Enterprise Manager)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
DBML 文件仅包含表、列、外键约束和主键。视图的存储方式与表相同,因此存储的唯一信息是视图的名称以及它返回的列(w/类型、可为空性等)。视图定义本身不被存储,因此无法从 dbml 文件中提取。
如果您使用 L2S 设计器和底层 DBML 文件进行数据建模,您将丢失:
也就是说,如果您想生成 SQL -DBML 中的表定义、FK、PK 等的 DDL,我的 Visual Studio 插件可以为您做到这一点。 (它支持同步 db -> dbml 和 dbml -> sql-ddl -> db 您可以从以下位置下载它并获取试用许可证:
http://www.huagati.com/dbmltools/
The DBML file only contain tables, columns, foreign key constraints, and primary keys. Views are stored in the same way as tables, so the only information stored is the name of the view and what columns (w/ type, nullability etc) that it return. The view definition itself is not stored and therefore not possible to extract from the dbml file.
If you use the L2S designer and the underlying DBML file for data modelling you will lose:
That said, if you want to generate the SQL-DDL for table defs, FKs, PKs etc from your DBML, my add-in for Visual Studio can do that for you. (It supports sync both ways db -> dbml, and dbml -> sql-ddl -> db You can download it and get a trial license from:
http://www.huagati.com/dbmltools/