I’m building a generic Repository<T> class that supports Linq to SQL, and I’d like to use a factory pattern for the DataContext, because currently I have to pass the correct context to the constructor.
Does anybody know how to determine the correct DataContext type for T, where T is a Linq to Sql Table?
You do not really need to.
Just take in a DataContext and you can access the tables using
GetTable<T>().