|
My Project
|
Functions | |
| builder.Services. | AddControllers () |
| builder.Services. | AddEndpointsApiExplorer () |
| builder.Services. | AddSwaggerGen (c=> { c.AddServer(new OpenApiServer { Url="http://localhost:8083", Description="Production Server" });var xmlCommentsFile=$"{Assembly.GetExecutingAssembly().GetName().Name}.xml";var xmlCommentsFullPath=Path.Combine(AppContext.BaseDirectory, xmlCommentsFile);c.IncludeXmlComments(xmlCommentsFullPath);}) |
| builder.Services. | AddSwaggerExamplesFromAssemblies (Assembly.GetEntryAssembly()) |
| builder.Services. | AddDbContext< ApplicationDbContext > (options=> { options.UseSqlServer(builder.Configuration.GetConnectionString("CodePulseConnectionString"));}) |
| builder.Services. | AddScoped< ICategoryRepository, CategoryRepository > () |
| builder.Services. | AddScoped< IBlogPostRepository, BlogPostRepository > () |
| if (app.Environment.IsDevelopment()) | |
| app. | Use (async(context, next)=> { await next();if(context.Response.StatusCode==404 &&!System.IO.Path.HasExtension(context.Request.Path.Value)) { context.Request.Path="/index.html";await next();} }) |
| app. | UseDefaultFiles () |
| app. | UseSwagger () |
| app. | UseSwaggerUI () |
| app. | UseStaticFiles () |
| app. | UseHttpsRedirection () |
| app. | UseCors (options=> { options.AllowAnyHeader();options.AllowAnyOrigin();options.AllowAnyMethod();}) |
| app. | UseAuthorization () |
| app. | MapControllers () |
| app. | Run () |
Variables | |
| var | builder = WebApplication.CreateBuilder(args) |
| var | app = builder.Build() |
| builder.Services. AddControllers | ( | ) |
| builder.Services. AddDbContext< ApplicationDbContext > | ( | options | , |
| { options.UseSqlServer(builder.Configuration.GetConnectionString("CodePulseConnectionString"));} | ) |
| builder.Services. AddEndpointsApiExplorer | ( | ) |
| builder.Services. AddScoped< IBlogPostRepository, BlogPostRepository > | ( | ) |
| builder.Services. AddScoped< ICategoryRepository, CategoryRepository > | ( | ) |
| builder.Services. AddSwaggerExamplesFromAssemblies | ( | Assembly. | GetEntryAssembly() | ) |
| builder.Services. AddSwaggerGen | ( | c | , |
| { c.AddServer(new OpenApiServer { Url="http://localhost:8083", Description="Production Server" });var xmlCommentsFile=$"{Assembly.GetExecutingAssembly().GetName().Name}.xml";var xmlCommentsFullPath=Path.Combine(AppContext.BaseDirectory, xmlCommentsFile);c.IncludeXmlComments(xmlCommentsFullPath);} | ) |
| if | ( | app.Environment.IsDevelopment() | ) |
| app. MapControllers | ( | ) |
| app. Run | ( | ) |
| app. Use | ( | async(context, next) | , |
| { await next();if(context.Response.StatusCode==404 &&!System.IO.Path.HasExtension(context.Request.Path.Value)) { context.Request.Path="/index.html";await next();} } | ) |
| app. UseAuthorization | ( | ) |
| app. UseCors | ( | options | , |
| { options.AllowAnyHeader();options.AllowAnyOrigin();options.AllowAnyMethod();} | ) |
| app. UseDefaultFiles | ( | ) |
| app. UseHttpsRedirection | ( | ) |
| app. UseStaticFiles | ( | ) |
| app. UseSwagger | ( | ) |
| app. UseSwaggerUI | ( | ) |
| var app = builder.Build() |
| var builder = WebApplication.CreateBuilder(args) |