Ronnie Overby
Ronnie Overby

Reputation: 46490

Working with sql server metadata in c#

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:

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?

Upvotes: 0

Views: 1556

Answers (2)

ChrisLively
ChrisLively

Reputation: 88092

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

Upvotes: 0

to StackOverflow
to StackOverflow

Reputation: 124794

You might want to look at SQL Server Management Objects.

Upvotes: 5

Related Questions