MVCscaffolding generates a model template from the database

advertisements

Is it possible while using MVCscaffolding and t4 templates to automatically generate a model with all table data from database

for example i have a table named Customers in my DB it has 3 fields:

Id Name Number

so can i make a t4 template that would generate something like this: (and it would work with all the tables + fields with other names)?????

using System;
using Data.EF.Model;
using Data.ViewModels.SlickGrid;

namespace Data.ViewModels.SlickGridDemo
{
    public class CustomerGridViewModel
    {
        public Int Id { get; set; }
        public string Name { get; set; }
        public int? Number { get; set; }
    }
}

well? anyone? is this possible?


Yes. It's relatively simple. Check out T4Toolbox http://t4toolbox.codeplex.com/