-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram.cs
62 lines (44 loc) · 2.01 KB
/
Program.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
using BLL.Functions;
using BLL.Interfaces;
using DAL.Functions;
using DAL.Interfaces;
using DAL.Models;
using Microsoft.EntityFrameworkCore;
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddControllers();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
builder.Services.AddDbContext<TripContext>(options => options.UseSqlServer("Server=.;Database=Trip;TrustServerCertificate=True;Trusted_Connection=True;"));
builder.Services.AddAutoMapper(typeof(Program));
builder.Services.AddScoped(typeof(IInvitationDAL), typeof(InvitationFunc));
builder.Services.AddScoped(typeof(IInvitationBll), typeof(InvitationFuncBll));
builder.Services.AddScoped(typeof(ITripDAL), typeof(TripFunc));
builder.Services.AddScoped(typeof(ITripBll), typeof(TripFuncBll));
builder.Services.AddScoped(typeof(ITypeTripDAL), typeof(TypeTripFunc));
builder.Services.AddScoped(typeof(ITypeTripBll), typeof(TypeTripFuncBll));
builder.Services.AddScoped(typeof(IUserDAL), typeof(UserFunc));
builder.Services.AddScoped(typeof(IUserBll), typeof(UserFuncBll));
builder.Services.AddCors(opotion => opotion.AddPolicy("all",//ðúéðú ùí ìäøùàä
p => p.AllowAnyOrigin()//îàôùø ëì î÷åø
.AllowAnyMethod()//ëì îúåãä - ôåð÷öéä
.AllowAnyHeader()));//åëì ëåúøú ôåð÷öéä
//äùåøä äáàä ðåúðú ô÷åãä ìäçæéø àú ëì äîùúðéí ëîå ùäí
//áìé ìäôåê àú äàåúéåú äøàùåðåú ì÷èðåú
//builder.Services.AddControllers()
// .AddJsonOptions(opts => opts.JsonSerializerOptions.PropertyNamingPolicy = null);
var app = builder.Build();
app.UseCors("all");
//àôùøåú ìäùúîù á÷áöéí äðîöàéí áùøú
app.UseStaticFiles();
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI();
}
app.UseHttpsRedirection();
app.UseAuthorization();
app.MapControllers();
app.Run();