Skip to main content

Posts

Showing posts from December, 2014

Advance enum generation for lookup table through T4

Sometime back I had written simple T4 to generate enum for look up tables http://vikutech.blogspot.in/2014/01/enumeration-generation-for-lookup-table.html. Later on I had posted same on Nu-Get https://www.nuget.org/packages/t4.lookup.

This time I am going to extend it to support multiple enums, enum Id, configuration through class and different settings for enum description, columns.

Here is the entire code for generating code

<#@ template debug="true" hostSpecific="true" #> <#@ output extension=".cs" #> <#@ Assembly Name="System.Data" #> <#@ import namespace="System" #> <#@ import namespace="System.Collections.Generic" #> <#@ include file="EF.Utility.CS.ttinclude"#> <#@ import namespace="System.Data.SqlClient" #> <# // TODO: Look for alternatives to remove connection string var connectString = "data source=.;initial catalog…