在 C# 中使用 sql server 元数据
是否有任何工具可以将 SQL Server 元数据的检索封装到一个漂亮的对象模型中?
我的直接需求是从 SQL Server 2000-2008 R2 收集这些东西:
- 数据库
- 表
- 外键约束
- 触发器
所以,也许给定一个 SqlConnection 对象,我可以做这样的事情:
var dbs = conn.GetDatabases();
var db = dbs.Single(x => x.Name == "AdventureWorks");
var tables = db.GetTables();
var triggers = db.GetAllTriggers();
当然,这些例子会非常方便,但任何排序对象模型会比我现在所做的更好。在我建立自己的之前,有什么东西吗?
Are there any tools out there that encapsulate the retrieval of SQL Server metadata into a nice object model?
My immediate needs are to gather these things from SQL Server 2000-2008 R2:
- Databases
- Tables
- Foreign key constraints
- Triggers
So, maybe given a SqlConnection object, I could do things like this:
var dbs = conn.GetDatabases();
var db = dbs.Single(x => x.Name == "AdventureWorks");
var tables = db.GetTables();
var triggers = db.GetAllTriggers();
Of course, those examples would be very convenient, but any sort of object model would be better than what I'm doing now. Before I build my own, is there anything out there?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可能需要查看SQL Server 管理对象。
You might want to look at SQL Server Management Objects.
也许我错过了一些东西,但相当很多 每个 ORM 出 那里< /a> 确实 这个。
Maybe I'm missing something, but pretty much every ORM out there does this.