-
Notifications
You must be signed in to change notification settings - Fork 50
Expand file tree
/
Copy pathHelixItem.tt
More file actions
57 lines (46 loc) · 1.72 KB
/
HelixItem.tt
File metadata and controls
57 lines (46 loc) · 1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<#@ template language="C#" #>
<#@ output encoding="utf-8"#>
<#@ include file="Helpers.tt" #>
<#@ include file="StringExtensions.tt" #>
<#@ include file="GeneralExtensions.tt" #>
<#@ include file="Inflector.tt" #>
<#@ assembly name="System.Core.dll" #>
<#@ import namespace="System" #>
<#@ import namespace="System.Text" #>
<#@ import namespace="System.Linq" #>
<#@ import namespace="System.Collections.Generic" #>
<#@ import namespace="HedgehogDevelopment.SitecoreProject.VSIP.CodeGeneration.Models" #>
<#@ parameter name="Model" type="HedgehogDevelopment.SitecoreProject.VSIP.CodeGeneration.Models.SitecoreItem" #>
<#@ parameter name="DefaultNamespace" type="System.String" #>
<#
/*
This TDS Code Generation template is used to generate objects that are compatible with the
Habitat Example Project based on the Helix Architecture Principles available @ https://github.com/Sitecore/Habitat
*/
#>
<#
// we only act on Templates
SitecoreTemplate template = Model as SitecoreTemplate;
if (template == null)
{
return "";
}
string Tool = "Team Development for Sitecore - HelixItem.tt";
string ToolVersion = "1.0";
#>
namespace <#= GetNamespace(DefaultNamespace, template)#>
{
public struct <#= AsStructName(template.Name) #>
{
public const string TemplateIdString = "<#= template.ID.ToString() #>";
public static readonly ID TemplateId = new ID(TemplateIdString);
public const string TemplateName = "<#= template.Name #>";
public struct Fields
{
<#foreach(SitecoreField field in GetFieldsForTemplate(template, true)){#>
public static readonly ID <#= GetPropertyName(field) #> = new ID("<#=field.ID.ToString()#>");
public const string <#= GetPropertyName(field) #>FieldName = "<#=field.Name#>";
<#}#>
}
}
}