1 Star 0 Fork 11

20级软件2班 / MVC示例项目

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
Startup.cs 1.66 KB
一键复制 编辑 原始数据 按行查看 历史
老胡来也 提交于 2021-12-27 17:03 . 数据库使用PostgreSQL
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using MVCDemoSoft2.Repository;
namespace MVCDemoSoft2
{
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
public IConfiguration Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.AddControllersWithViews();
// services.AddDbContext<MVCDemoSoft2.Db.DemoSoft2>();
services.AddScoped(typeof(IRepository<>),typeof(EfRepository<>));
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
else
{
app.UseExceptionHandler("/Home/Error");
}
app.UseStaticFiles();
app.UseRouting();
app.UseAuthorization();
app.UseEndpoints(endpoints =>
{
endpoints.MapControllerRoute(
name: "default",
pattern: "{controller=Book}/{action=Index}/{id?}");
});
}
}
}
1
https://gitee.com/level-20-software-class-other-2/mvc-sample-project.git
git@gitee.com:level-20-software-class-other-2/mvc-sample-project.git
level-20-software-class-other-2
mvc-sample-project
MVC示例项目
master

搜索帮助