public async Task RunAsync() { var result = await _templateContentProvider .GetContentOrNullAsync("Hello"); Console.WriteLine(result); }
public virtual async Task <Assembly> GetAssemblyAsync(TemplateDefinition templateDefinition) { async Task <Assembly> CreateAssembly(string content) { using (var assemblyStream = await GetAssemblyStreamAsync(templateDefinition, content)) { return(Assembly.Load(await assemblyStream.GetAllBytesAsync())); } } var templateContent = await _templateContentProvider.GetContentOrNullAsync(templateDefinition); return(CachedAssembles.GetOrAdd((templateDefinition.Name + templateContent).ToMd5(), await CreateAssembly(templateContent))); }
protected virtual async Task <string> RenderSingleTemplateAsync( TemplateDefinition templateDefinition, Dictionary <string, object> globalContext, object model = null) { var rawTemplateContent = await _templateContentProvider .GetContentOrNullAsync( templateDefinition ); return(await RenderTemplateContentWithScribanAsync( templateDefinition, rawTemplateContent, globalContext, model )); }
protected virtual async Task <string> GetContentOrNullAsync(TemplateDefinition templateDefinition) { return(await TemplateContentProvider.GetContentOrNullAsync(templateDefinition)); }