1 Star 0 Fork 0

yugang/SchoolManagement

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
Startup.cs 1.60 KB
一键复制 编辑 原始数据 按行查看 历史
yugang 提交于 2021-11-25 17:40 . 仓储
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?}");
});
}
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C#
1
https://gitee.com/MuFengSanSheng/school-management.git
git@gitee.com:MuFengSanSheng/school-management.git
MuFengSanSheng
school-management
SchoolManagement
master

搜索帮助