开发者

Working with sql server metadata in c#

开发者 https://www.devze.com 2023-01-27 11:34 出处:网络
Are there any tools out there that encapsulate the retrieval of SQL Server metadata into a nice 开发者_运维技巧object model?

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?


You might want to look at SQL Server Management Objects.


Maybe I'm missing something, but pretty much every ORM out there does this.

0

精彩评论

暂无评论...
验证码 换一张
取 消