-
Notifications
You must be signed in to change notification settings - Fork 419
T4 Template
ericdc1 edited this page Jan 28, 2013
·
3 revisions
You can autogenerate your POCOs directly from your database using this T4 Template
You can also install it using Nuget
You specify a connection string (from web.config or app.config) and set a namespace and the template will generate a class per table with necessary attributes. Primary Key fields are marked with the [Key] attribute. The classes for the table names are converted to singular form (Users becomes User) and the [Table("Name")] attribute is applied.
The class and each property is virtual so you can override them in your own classes to add things like data annotations.
Check out the sample website project for example usage.