-
Notifications
You must be signed in to change notification settings - Fork 51
/
MDDocHeader.tt
154 lines (125 loc) · 4.9 KB
/
MDDocHeader.tt
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
<#@ template language="C#" #>
<#
// The Header Template is used to generate code that goes at the top of the generated code file. This template is executed only once.
// it will typically generate #using statements or add other one time only elements to the generated file.
//Parameters passed to Template for code generation
// Model: The ProjectHeder object contains information about the TDS project generating the code and the project where the
// generated code will reside.
// DefaultNamespace: The DefaultNamespace parameter contains the default namespace of the project where the generated
// code file resides.
#>
<#@ parameter name="Model" type="HedgehogDevelopment.SitecoreProject.VSIP.CodeGeneration.Models.ProjectHeader" #>
<#@ parameter name="DefaultNamespace" type="System.String" #>
# TDS Template Transform Documentation
This is a markdown file that is outputted via TDS Code Generation. You can view this file with a text editor or a markdown editor for proper formatting.
Generating from TDS Project: `<#= Model.TDSProjectName #>`
Path to TDS Project: `<#= Model.TDSProjectPath #>`
Generating to Project: `<#= Model.TargetProjectName #>`
Path to Target Project: `<#= Model.TargetProjectPath #>`
Path to generated file: `<#= Model.GeneratedFilePath #>`
Target Project Default Namespace: `<#= DefaultNamespace #>`
## Code Generation Models.
The following types are used during code generation:
public class ProjectHeader
{
/// <summary>
/// The name of the TDS project
/// </summary>
public string TDSProjectName { get; set; }
/// <summary>
/// The full path to the TDS project file
/// </summary>
public string TDSProjectPath { get; set; }
/// <summary>
/// The name of the target project
/// </summary>
public string TargetProjectName { get; set; }
/// <summary>
/// The full path to the target project
/// </summary>
public string TargetProjectPath { get; set; }
/// <summary>
/// The full path to the generated project file
/// </summary>
public string GeneratedFilePath { get; set; }
/// <summary>
/// Gets or sets the base namespace as set in the TDS project.
/// </summary>
public string BaseNamespace { get; set; }
}
/// <summary>
/// Represents the SitecoreItem to be passed to the T4 template. Any object that is a SitecoreItem will inherit from this object.
/// </summary>
public class SitecoreItem
{
/// <summary>
/// The Sitecore item ID.
/// </summary>
public Guid ID { get; set; }
/// <summary>
/// The name of the Sitecore item. This may be different than the Display Name.
/// </summary>
public string Name { get; set; }
/// <summary>
/// The path to the item from the Sitecore root.
/// </summary>
public string Path { get; set; }
/// <summary>
/// Any custom data associated with the item. This data can be set on the property page associated with the Sitecore item in the solution explorer.
/// </summary>
public string Data { get; set; }
/// <summary>
/// The Parent SitecoreItem in the Sitecore hierarchy.
/// </summary>
public SitecoreItem Parent { get; set; }
/// <summary>
/// The name of the template the item is based on
/// </summary>
public string TemplateName { get; set; }
/// <summary>
/// The ID of the template the item is based on
/// </summary>
public Guid TemplateId { get; set; }
/// <summary>
/// Additional sitecore fields. These fields are set on the Code Generation Property page.
/// The key in the dictionary is the Field name, the value is the value of the field.
/// </summary>
public Dictionary<string, string> SitecoreFields;
/// <summary>
/// The calculated Namespace for the item. Each Sitecore item above the template is represented as part of the namespace.
/// A new Namespace can be set at any item in the items property page. This allows the code generation namespace to be arranged differently
/// than the Sitecore template hierarchy.
/// </summary>
public string Namespace { get; set; }
}
/// <summary>
/// Represents Template specific information for code generation.
/// </summary>
public class SitecoreTemplate : SitecoreItem
{
/// <summary>
/// The namespace broken out into individual segments.
/// </summary>
public IEnumerable<string> NamespaceSegments { get; }
/// <summary>
/// A list of all templates this template inherits from.
/// </summary>
public List<SitecoreTemplate> BaseTemplates { get; set; }
/// <summary>
/// A list of Sitecore Fields that make up this sitecore template.
/// </summary>
public List<SitecoreField> Fields { get; set; }
}
/// <summary>
/// Represents Field specific information for code generation.
/// </summary>
public class SitecoreField : SitecoreItem
{
/// <summary>
/// The type of the field from the template editor.
/// </summary>
public string Type { get; set; }
}
*End of MDDocHeader.tt*
----------------------------------------------------------
## Generated Code