LINQ to SQL templates for T4-Adding Interfaces for C#

6. October 2009

I was working in these templates and wanted to add interfaces.  

I found a link in the discussions here, from Jwooley stating he had done this: http://www.thinqlinq.com/Post.aspx/Title/Generating-Interfaces-for-LINQ-to-SQL-Entities

Well he did it, but in Visual basic and I needed C#, so I changed up the script.   I tried to add this script to his site, but the submission didnt allow it so I will post it here and add a link to his site.

Hope this saves someone a little time:

(Follow the instructions on the think link site and replace this part :

namespace <#=data.EntityNamespace#>	
{
<#		}
#><#if (options.CreateInterfaces) { #>
	/// <summary>
    /// <#=class1.Name#> interface
    /// </summary>
	<#=code.Format(class1.TypeAttributes)#>interface I<#=class1.Name#>
	{
	<#			foreach(Column column in class1.Columns) {#>
	<# if (column.IsReadOnly) {#>ReadOnly <#}#> <#=code.Format(column.Type)#> <#=column.Member#>{ get; set; }
	<# } 
	#>
	}
<# } 
#>
<#		if (data.Serialization && class1.IsSerializable) {

.Net , C#, Programming