-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
39 lines (28 loc) · 909 Bytes
/
Program.cs
File metadata and controls
39 lines (28 loc) · 909 Bytes
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
33
34
35
36
37
38
39
using Commander.Data;
using Commander.Profiles;
using Microsoft.EntityFrameworkCore;
using Newtonsoft.Json.Serialization;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddDbContext<CommanderContext>(options =>
options.UseSqlServer(builder.Configuration.GetConnectionString("CommanderConnection")));
builder.Services
.AddControllers()
.AddNewtonsoftJson(options =>
{
options.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();
});
builder.Services.AddAutoMapper(_ => { }, typeof(CommandsProfile).Assembly);
builder.Services.AddScoped<ICommanderRepo, SqlCommanderRepo>();
var app = builder.Build();
if (app.Environment.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.UseHttpsRedirection();
app.UseAuthorization();
app.MapControllers();
app.Run();
namespace Commander
{
public partial class Program;
}