Question

I am trying to create a data access layer using t4 and C#. I would like to be able to provide a DAL where I can access any database. The problem I am having is with some of the schema information. I am able to retrieve some information like column and table names but I would also like other information like the name of the primary key field, the primary key value. What's the most efficient way of doing this?

Was it helpful?

Solution

If you are targeting Microsoft SQL Server, Server Management Objects (SMO) is the best option. Here is an example.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top