subsonicsubsonic3

Use SubSonic 3.0 SimpleRepository to an existing database


I want to use the SubSonic 3.0 SimpleRepository in my project, but there is a problem:

If my table's name like Product, etc., then I can't get any data from database, because SubSonic generate the SQL statement like "Select * from Products ..."

PS: I don't want to change my table name.

I wrote a T4 template to solve this problem, and I hope someone can take a look at my code. Am I do the right thing?

Code: SimpleRepositoryDemo


Solution

  • It sounds like you already have a database designed in which case I would suggest you use the LinqTemplates or ActiveRecord instead. SimpleRepository seems to really be suited to a code first development process rather than a database first.