Created
August 26, 2018 18:17
-
-
Save dalion619/00f647e12887e5e4e2092a62427fe169 to your computer and use it in GitHub Desktop.
RazorEngine TemplateServiceConfiguration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Path needed for the ability to call this project in an ASP.NET project. | |
var codeBase = Assembly.GetExecutingAssembly().CodeBase; | |
var codeBaseUri = new UriBuilder(codeBase); | |
var uriPath = Uri.UnescapeDataString(codeBaseUri.Path); | |
var dirPath = Path.GetDirectoryName(uriPath); | |
// ResolvePathTemplateManager with no caching. | |
_razorEngineService = RazorEngine.Templating.RazorEngineService.Create(new TemplateServiceConfiguration | |
{ | |
TemplateManager = new ResolvePathTemplateManager(new[] | |
{$@"{dirPath}\EmailPartialViews", $@"{dirPath}\EmailViews"}), | |
DisableTempFileLocking = true, | |
CachingProvider = new DefaultCachingProvider(t => { }) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment