-
Notifications
You must be signed in to change notification settings - Fork 2
/
startup.cs
32 lines (23 loc) · 827 Bytes
/
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
29
30
31
32
using System;
using Microsoft.Azure.Functions.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.EntityFrameworkCore;
using CRUD.Function.Services;
using CRUD.Function.Data;
[assembly: FunctionsStartup(typeof(CRUD.Function.Startup))]
namespace CRUD.Function
{
public class Startup : FunctionsStartup
{
public override void Configure(IFunctionsHostBuilder builder)
{
var connectionString = Environment.GetEnvironmentVariable("SqlServerConnection");
builder.Services.AddDbContext<DataContext>(x =>
{
x.UseSqlServer(connectionString
, options=>options.EnableRetryOnFailure());
});
builder.Services.AddTransient<ICRUDService, CrudService>();
}
}
}