Skip to content

Commit c9a3b37

Browse files
Update README.md
1 parent eba43eb commit c9a3b37

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,10 @@ RazorEngineCompiledTemplate<MyBase> template1 = RazorEngineCompiledTemplate<MyBa
7575
RazorEngineCompiledTemplate<MyBase> template2 = RazorEngineCompiledTemplate<MyBase>.LoadFromStream<MyBase>(myStream);
7676
```
7777

78-
#### Simplest thread safe caching pattern
78+
#### Caching
79+
RazorEngineCore is not responsible for caching. Each team and project has their own caching frameworks and conventions therefore making it is impossible to have builtin solution for all possible needs.
80+
81+
If you dont have one, use following static ConcurrentDictionary example as a simplest solution.
7982

8083
```cs
8184
private static ConcurrentDictionary<string, RazorEngineCompiledTemplate> TemplateCache = new ConcurrentDictionary<string, RazorEngineCompiledTemplate>();
@@ -151,7 +154,10 @@ public class CustomModel : RazorEngineTemplateBase
151154
}
152155
```
153156

154-
### Referencing assemblies
157+
#### Referencing assemblies
158+
Keep your templates as simple as possible, if you need to inject "unusual" assemblies most likely you are doing it wrong.
159+
Writing `@using System.IO` in template will not reference System.IO assembly, use builder to manually reference it.
160+
155161
```cs
156162
RazorEngine razorEngine = new RazorEngine();
157163
RazorEngineCompiledTemplate compiledTemplate = razorEngine.Compile(templateText, builder =>

0 commit comments

Comments
 (0)