tags:

views:

104

answers:

1

Hello,

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?

+1  A: 

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

Oleg Sych
Hey thanks, what about db's like odbc and oledb?
jumbojs