@@ -17,14 +17,14 @@ public class RazorEngine : IRazorEngine
1717 public IRazorEngineCompiledTemplate < T > Compile < T > ( string content , Action < IRazorEngineCompilationOptionsBuilder > builderAction = null ) where T : IRazorEngineTemplate
1818 {
1919 IRazorEngineCompilationOptionsBuilder compilationOptionsBuilder = new RazorEngineCompilationOptionsBuilder ( ) ;
20-
20+
2121 compilationOptionsBuilder . AddAssemblyReference ( typeof ( T ) . Assembly ) ;
2222 compilationOptionsBuilder . Inherits ( typeof ( T ) ) ;
2323
2424 builderAction ? . Invoke ( compilationOptionsBuilder ) ;
2525
2626 MemoryStream memoryStream = this . CreateAndCompileToStream ( content , compilationOptionsBuilder . Options ) ;
27-
27+
2828 return new RazorEngineCompiledTemplate < T > ( memoryStream ) ;
2929 }
3030
@@ -37,7 +37,7 @@ public IRazorEngineCompiledTemplate Compile(string content, Action<IRazorEngineC
3737 {
3838 IRazorEngineCompilationOptionsBuilder compilationOptionsBuilder = new RazorEngineCompilationOptionsBuilder ( ) ;
3939 compilationOptionsBuilder . Inherits ( typeof ( RazorEngineTemplateBase ) ) ;
40-
40+
4141 builderAction ? . Invoke ( compilationOptionsBuilder ) ;
4242
4343 MemoryStream memoryStream = this . CreateAndCompileToStream ( content , compilationOptionsBuilder . Options ) ;
@@ -49,8 +49,8 @@ public Task<IRazorEngineCompiledTemplate> CompileAsync(string content, Action<IR
4949 {
5050 return Task . Factory . StartNew ( ( ) => this . Compile ( content : content , builderAction : builderAction ) ) ;
5151 }
52-
53- private MemoryStream CreateAndCompileToStream ( string templateSource , RazorEngineCompilationOptions options )
52+
53+ protected virtual MemoryStream CreateAndCompileToStream ( string templateSource , RazorEngineCompilationOptions options )
5454 {
5555 templateSource = this . WriteDirectives ( templateSource , options ) ;
5656
@@ -65,7 +65,7 @@ private MemoryStream CreateAndCompileToStream(string templateSource, RazorEngine
6565 string fileName = Path . GetRandomFileName ( ) ;
6666
6767 RazorSourceDocument document = RazorSourceDocument . Create ( templateSource , fileName ) ;
68-
68+
6969 RazorCodeDocument codeDocument = engine . Process (
7070 document ,
7171 null ,
@@ -123,7 +123,7 @@ private MemoryStream CreateAndCompileToStream(string templateSource, RazorEngine
123123 return memoryStream ;
124124 }
125125
126- private string WriteDirectives ( string content , RazorEngineCompilationOptions options )
126+ protected virtual string WriteDirectives ( string content , RazorEngineCompilationOptions options )
127127 {
128128 StringBuilder stringBuilder = new StringBuilder ( ) ;
129129 stringBuilder . AppendLine ( $ "@inherits { options . Inherits } ") ;
0 commit comments