代码拉取完成,页面将自动刷新
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using SchoolManagement.DataReponstories;
using SchoolManagement.Infrastructure;
namespace SchoolManagement
{
public class Startup
{
public IConfiguration _configuration;
public Startup(IConfiguration configuration)
{
_configuration = configuration;
}
public void ConfigureServices(IServiceCollection services)
{
services.AddDbContextPool<AppDbContext>(options =>
{
options.UseSqlServer(_configuration.GetConnectionString("DBConnectionString"));
});
services.AddControllersWithViews();
services.AddTransient<IStudentReponstory, SQLStudentReponstory>();
services.AddTransient(typeof(IReponstory<,>), typeof(ReponstoryBase<,>));
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
} else{
app.UseStatusCodePagesWithRedirects("Error/{0}");
}
app.UseRouting(); //主要验证终结点路由是否加载到了管道中
app.UseEndpoints(endpoints =>
{
endpoints.MapControllerRoute(
name: "default",
pattern: "{controller=Home}/{action=index}/{id?}");
});
}
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。