Skip to content

Instantly share code, notes, and snippets.

@KyleMit
Created January 25, 2018 03:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KyleMit/fc9ccfbc2af03462d660257103326509 to your computer and use it in GitHub Desktop.
Save KyleMit/fc9ccfbc2af03462d660257103326509 to your computer and use it in GitHub Desktop.
Used to help debug input and output for T4 templates and expose values in ModelMetatdata
<#@ template language="C#" HostSpecific="True" #>
<#@ output extension=".txt" #>
<#@ include file="Imports.include.t4" #>
<#@ include file="ModelMetadataFunctions.cs.include.t4" #>
T4 Info Dump
ViewName: <#= ViewName #>
ViewDataTypeName: <#= ViewDataTypeName #>
IsPartialView: <#= IsPartialView #>
IsLayoutPageSelected: <#= IsLayoutPageSelected #>
IsBundleConfigPresent: <#= IsBundleConfigPresent #>
ReferenceScriptLibraries: <#= ReferenceScriptLibraries #>
LayoutPageFile: <#= LayoutPageFile #>
<#
// use this to generate editor template
int i = 0;
// this is the heavy lifting - include a lot of props
foreach (PropertyMetadata property in ModelMetadata.Properties) {
#>
Property Number: <#= i #>
PropertyName <#= property.PropertyName #>
TypeName <#= property.TypeName #>
ShortTypeName <#= property.ShortTypeName #>
InlucdeInLoop <#= property.Scaffold && !property.IsAutoGenerated && !property.IsReadOnly && !property.IsAssociation #>
Scaffold <#= property.Scaffold #>
IsReadOnly <#= property.IsReadOnly #>
IsAutoGenerated <#= property.IsAutoGenerated #>
IsAssociation <#= property.IsAssociation #>
IsPrimaryKey <#= property.IsPrimaryKey #>
IsForeignKey <#= property.IsForeignKey #>
IsComplexType <#= property.IsComplexType #>
IsConcurrencyProperty <#= property.IsConcurrencyProperty #>
IsEnum <#= property.IsEnum #>
IsEnumFlags <#= property.IsEnumFlags #>
IsIndependentAssociation <#= property.IsIndependentAssociation #>
AssociationDirection <#= property.AssociationDirection #>
<#
i+=1;
} // end of partial view
#>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment