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:
- Foreign key constraints
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.