-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathStartup.cs
28 lines (27 loc) · 1.15 KB
/
Startup.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
using AzureFunctionsRazorEmailTemplateSample;
using Microsoft.Azure.Functions.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Localization;
using Microsoft.Extensions.ObjectPool;
using System.IO;
using System.Reflection;
[assembly: FunctionsStartup(typeof(Startup))]
namespace AzureFunctionsRazorEmailTemplateSample
{
class Startup : FunctionsStartup
{
public override void Configure(IFunctionsHostBuilder builder)
{
string executionPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
var compiledViewAssembly = Assembly.LoadFile(Path.Combine(executionPath, "AzureFunctionsRazorEmailTemplateSample.Views.dll"));
builder.Services
.AddSingleton<IStringLocalizerFactory, ResourceManagerStringLocalizerFactory>()
.AddScoped<RazorViewToStringRenderer>()
.AddSingleton<ObjectPoolProvider, DefaultObjectPoolProvider>()
.AddMvcCore()
.AddViews()
.AddRazorViewEngine()
.AddApplicationPart(compiledViewAssembly);
}
}
}