Skip to content

Commit 6045d53

Browse files
Merge pull request #140 from MichaelCleverdon/Documentation
Adding documentation to RazorEngineCompilationOptionsBuilder
2 parents 64dbcd9 + e32f1cc commit 6045d53

File tree

2 files changed

+76
-0
lines changed

2 files changed

+76
-0
lines changed

RazorEngineCore/IRazorEngineCompilationOptionsBuilder.cs

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,53 @@ public interface IRazorEngineCompilationOptionsBuilder
88
{
99
RazorEngineCompilationOptions Options { get; set; }
1010

11+
/// <summary>
12+
/// Loads the Assembly by name and adds it to the Engine's Assembly Reference list
13+
/// </summary>
14+
/// <param name="assemblyName">Full Name of the Assembly to add to the assembly list</param>
1115
void AddAssemblyReferenceByName(string assemblyName);
16+
17+
/// <summary>
18+
/// Adds a loaded assembly to the Engine's Assembly Reference list
19+
/// </summary>
20+
/// <param name="assembly">Assembly to add to the assembly list</param>
1221
void AddAssemblyReference(Assembly assembly);
22+
23+
/// <summary>
24+
/// <para>Adds a type's assembly to the Engine's Assembly Reference list</para>
25+
/// <para>Also adds the type's GenericTypeArguments to the Reference list as well</para>
26+
/// </summary>
27+
/// <param name="type">The type who's assembly should be added to the assembly list</param>
1328
void AddAssemblyReference(Type type);
29+
30+
/// <summary>
31+
/// Adds a MetadataReference for use in the Engine's Assembly Reference generation
32+
/// </summary>
33+
/// <param name="reference">Metadata Reference to add to the Engine's Referenced Assemblies</param>
1434
void AddMetadataReference(MetadataReference reference);
35+
36+
/// <summary>
37+
/// <para>Adds a default <c>using</c> to the compiled view. This is equivalent to adding <c>@using [NAMESPACE]</c> to every template rendered by the engine'</para>
38+
/// Current Defaults:
39+
/// <list type="bullet">
40+
/// <listheader></listheader>
41+
/// <item>System.Linq</item>
42+
/// <item>System.Collections</item>
43+
/// <item>System.Collections.Generic</item>
44+
/// </list>
45+
/// </summary>
46+
/// <param name="namespaceName">Namespace to add to default usings</param>
1547
void AddUsing(string namespaceName);
48+
49+
/// <summary>
50+
/// Adds <c>@inherits</c> directive to the compiled template
51+
/// </summary>
52+
/// <param name="type">Type to <c>@inherits</c> from</param>
1653
void Inherits(Type type);
54+
55+
/// <summary>
56+
/// Enables debug info
57+
/// </summary>
1758
void IncludeDebuggingInfo();
1859
}
1960
}

RazorEngineCore/RazorEngineCompilationOptionsBuilder.cs

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,30 @@ public RazorEngineCompilationOptionsBuilder(RazorEngineCompilationOptions option
1515
this.Options = options ?? new RazorEngineCompilationOptions();
1616
}
1717

18+
/// <summary>
19+
/// Loads the Assembly by name and adds it to the Engine's Assembly Reference list
20+
/// </summary>
21+
/// <param name="assemblyName">Full Name of the Assembly to add to the assembly list</param>
1822
public void AddAssemblyReferenceByName(string assemblyName)
1923
{
2024
Assembly assembly = Assembly.Load(new AssemblyName(assemblyName));
2125
this.AddAssemblyReference(assembly);
2226
}
2327

28+
/// <summary>
29+
/// Adds a loaded assembly to the Engine's Assembly Reference list
30+
/// </summary>
31+
/// <param name="assembly">Assembly to add to the assembly list</param>
2432
public void AddAssemblyReference(Assembly assembly)
2533
{
2634
this.Options.ReferencedAssemblies.Add(assembly);
2735
}
2836

37+
/// <summary>
38+
/// <para>Adds a type's assembly to the Engine's Assembly Reference list</para>
39+
/// <para>Also adds the type's GenericTypeArguments to the Reference list as well</para>
40+
/// </summary>
41+
/// <param name="type">The type who's assembly should be added to the assembly list</param>
2942
public void AddAssemblyReference(Type type)
3043
{
3144
this.AddAssemblyReference(type.Assembly);
@@ -36,16 +49,35 @@ public void AddAssemblyReference(Type type)
3649
}
3750
}
3851

52+
/// <summary>
53+
/// Adds a MetadataReference for use in the Engine's Assembly Reference generation
54+
/// </summary>
55+
/// <param name="reference">Metadata Reference to add to the Engine's Referenced Assemblies</param>
3956
public void AddMetadataReference(MetadataReference reference)
4057
{
4158
this.Options.MetadataReferences.Add(reference);
4259
}
4360

61+
/// <summary>
62+
/// <para>Adds a default <c>using</c> to the compiled view. This is equivalent to adding <c>@using [NAMESPACE]</c> to the template rendered by the engine'</para>
63+
/// Current Defaults:
64+
/// <list type="bullet">
65+
/// <listheader></listheader>
66+
/// <item>System.Linq</item>
67+
/// <item>System.Collections</item>
68+
/// <item>System.Collections.Generic</item>
69+
/// </list>
70+
/// </summary>
71+
/// <param name="namespaceName">Namespace to add to default usings</param>
4472
public void AddUsing(string namespaceName)
4573
{
4674
this.Options.DefaultUsings.Add(namespaceName);
4775
}
4876

77+
/// <summary>
78+
/// Adds <c>@inherits</c> directive to the compiled template
79+
/// </summary>
80+
/// <param name="type">Type to <c>@inherits</c> from</param>
4981
public void Inherits(Type type)
5082
{
5183
this.Options.Inherits = this.RenderTypeName(type);
@@ -94,6 +126,9 @@ private string RenderDeclaringType(Type type)
94126
return parent + "." + type.Name;
95127
}
96128

129+
/// <summary>
130+
/// Enables debug info
131+
/// </summary>
97132
public void IncludeDebuggingInfo()
98133
{
99134
this.Options.IncludeDebuggingInfo = true;

0 commit comments

Comments
 (0)