提交.Net6版本
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Interface;
|
||||
using Yi.Framework.Model.Models;
|
||||
|
||||
namespace Yi.Framework.PageDetail.Controllers
|
||||
{
|
||||
public class PageDetaiController : Controller
|
||||
{
|
||||
private IUserService _IUserService;
|
||||
public PageDetaiController(IUserService IUserService)
|
||||
{
|
||||
_IUserService = IUserService;
|
||||
}
|
||||
[Route("/item/{id}.html")]
|
||||
public IActionResult Index(int id)
|
||||
{
|
||||
var htmlmodel = _IUserService.GetEntityById(id);
|
||||
return View(htmlmodel);
|
||||
}
|
||||
}
|
||||
}
|
||||
65
Yi.Framework.Net5/Yi.Framework.PageDetail/Log4net.config
Normal file
65
Yi.Framework.Net5/Yi.Framework.PageDetail/Log4net.config
Normal file
@@ -0,0 +1,65 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<log4net>
|
||||
<!-- 将日志以回滚文件的形式写到文件中 -->
|
||||
<!-- 按日期切分日志文件,并将日期作为日志文件的名字 -->
|
||||
<!--Error-->
|
||||
<appender name="ErrorLog" type="log4net.Appender.RollingFileAppender">
|
||||
<!--不加utf-8编码格式,中文字符将显示成乱码-->
|
||||
<param name="Encoding" value="utf-8" />
|
||||
<file value="log/"/>
|
||||
<appendToFile value="true" />
|
||||
<rollingStyle value="Date" />
|
||||
<!--日期的格式,每天换一个文件记录,如不设置则永远只记录一天的日志,需设置-->
|
||||
<datePattern value=""GlobalExceptionLogs_"yyyyMMdd".log"" />
|
||||
<!--日志文件名是否为静态-->
|
||||
<StaticLogFileName value="false"/>
|
||||
<!--多线程时采用最小锁定-->
|
||||
<lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
|
||||
<!--布局(向用户显示最后经过格式化的输出信息)-->
|
||||
<layout type="log4net.Layout.PatternLayout">
|
||||
<conversionPattern value="%date| %-5level %newline%message%newline--------------------------------%newline" />
|
||||
</layout>
|
||||
<filter type="log4net.Filter.LevelRangeFilter">
|
||||
<levelMin value="ERROR" />
|
||||
<levelMax value="FATAL" />
|
||||
</filter>
|
||||
</appender>
|
||||
<!--Error-->
|
||||
|
||||
|
||||
|
||||
<!--Info-->
|
||||
<appender name="InfoLog" type="log4net.Appender.RollingFileAppender">
|
||||
<!--不加utf-8编码格式,中文字符将显示成乱码-->
|
||||
<param name="Encoding" value="utf-8" />
|
||||
<!--定义文件存放位置-->
|
||||
<file value="log/"/>
|
||||
<appendToFile value="true" />
|
||||
<rollingStyle value="Date" />
|
||||
<!--日志文件名是否为静态-->
|
||||
<StaticLogFileName value="false"/>
|
||||
<!--日期的格式,每天换一个文件记录,如不设置则永远只记录一天的日志,需设置-->
|
||||
<datePattern value=""GlobalInfoLogs_"yyyyMMdd".log"" />
|
||||
<!--多线程时采用最小锁定-->
|
||||
<lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
|
||||
<!--布局(向用户显示最后经过格式化的输出信息)-->
|
||||
<layout type="log4net.Layout.PatternLayout">
|
||||
<conversionPattern value="%date| %-5level%c %newline%message%newline--------------------------------%newline" />
|
||||
</layout>
|
||||
<filter type="log4net.Filter.LevelRangeFilter">
|
||||
<levelMin value="DEBUG" />
|
||||
<levelMax value="WARN" />
|
||||
</filter>
|
||||
</appender>
|
||||
<!--Info-->
|
||||
|
||||
<root>
|
||||
<!-- 控制级别,由低到高:ALL|DEBUG|INFO|WARN|ERROR|FATAL|OFF -->
|
||||
<!-- 比如定义级别为INFO,则INFO级别向下的级别,比如DEBUG日志将不会被记录 -->
|
||||
<!-- 如果没有定义LEVEL的值,则缺省为DEBUG -->
|
||||
<level value="ALL" />
|
||||
<!-- 按日期切分日志文件,并将日期作为日志文件的名字 -->
|
||||
<appender-ref ref="ErrorLog" />
|
||||
<appender-ref ref="InfoLog" />
|
||||
</root>
|
||||
</log4net>
|
||||
42
Yi.Framework.Net5/Yi.Framework.PageDetail/Program.cs
Normal file
42
Yi.Framework.Net5/Yi.Framework.PageDetail/Program.cs
Normal file
@@ -0,0 +1,42 @@
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Yi.Framework.PageDetail
|
||||
{
|
||||
public class Program
|
||||
{
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
CreateHostBuilder(args).Build().Run();
|
||||
}
|
||||
|
||||
public static IHostBuilder CreateHostBuilder(string[] args) =>
|
||||
Host.CreateDefaultBuilder(args)
|
||||
.ConfigureAppConfiguration((hostBuilderContext, configurationBuilder) =>
|
||||
{
|
||||
configurationBuilder.AddCommandLine(args);
|
||||
configurationBuilder.AddJsonFile("appsettings.json", optional: true, reloadOnChange: false);
|
||||
configurationBuilder.AddJsonFile("configuration.json", optional: false, reloadOnChange: true);
|
||||
#region
|
||||
//Apollo<6C><6F><EFBFBD><EFBFBD>
|
||||
#endregion
|
||||
//configurationBuilder.AddApolloService("Yi");
|
||||
})
|
||||
.ConfigureLogging(loggingBuilder =>
|
||||
{
|
||||
loggingBuilder.AddFilter("System", Microsoft.Extensions.Logging.LogLevel.Warning);
|
||||
loggingBuilder.AddFilter("Microsoft", Microsoft.Extensions.Logging.LogLevel.Warning);
|
||||
loggingBuilder.AddLog4Net();
|
||||
})
|
||||
.ConfigureWebHostDefaults(webBuilder =>
|
||||
{
|
||||
webBuilder.UseStartup<Startup>().UseUrls("http://*:7007");
|
||||
});
|
||||
}
|
||||
}
|
||||
58
Yi.Framework.Net5/Yi.Framework.PageDetail/Startup.cs
Normal file
58
Yi.Framework.Net5/Yi.Framework.PageDetail/Startup.cs
Normal file
@@ -0,0 +1,58 @@
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Yi.Framework.Interface;
|
||||
using Yi.Framework.Service;
|
||||
using Yi.Framework.WebCore.MiddlewareExtend;
|
||||
|
||||
namespace Yi.Framework.PageDetail
|
||||
{
|
||||
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.AddIocService(Configuration);
|
||||
|
||||
services.AddControllers();
|
||||
#region
|
||||
//Swagger<65><72><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
#endregion
|
||||
services.AddSwaggerService<Program>("Yi.Framework.OcelotGateway.PageDetail");
|
||||
|
||||
services.AddScoped<IUserService,UserService>();
|
||||
}
|
||||
|
||||
// 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();
|
||||
#region
|
||||
//Swagger<65><72><EFBFBD><EFBFBD>ע<EFBFBD><D7A2>
|
||||
#endregion
|
||||
app.UseSwaggerService();
|
||||
}
|
||||
|
||||
app.UseHttpsRedirection();
|
||||
|
||||
app.UseRouting();
|
||||
|
||||
app.UseAuthorization();
|
||||
|
||||
app.UseEndpoints(endpoints =>
|
||||
{
|
||||
endpoints.MapControllers();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
8
Yi.Framework.Net5/Yi.Framework.PageDetail/SwaggerDoc.xml
Normal file
8
Yi.Framework.Net5/Yi.Framework.PageDetail/SwaggerDoc.xml
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0"?>
|
||||
<doc>
|
||||
<assembly>
|
||||
<name>Yi.Framework.PageDetail</name>
|
||||
</assembly>
|
||||
<members>
|
||||
</members>
|
||||
</doc>
|
||||
@@ -0,0 +1,90 @@
|
||||
@model Yi.Framework.Model.Models.user
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Index";
|
||||
}
|
||||
|
||||
<h1>Index</h1>
|
||||
|
||||
<div>
|
||||
<h4>user</h4>
|
||||
<hr />
|
||||
<dl class="row">
|
||||
<dt class = "col-sm-2">
|
||||
@Html.DisplayNameFor(model => model.username)
|
||||
</dt>
|
||||
<dd class = "col-sm-10">
|
||||
@Html.DisplayFor(model => model.username)
|
||||
</dd>
|
||||
<dt class = "col-sm-2">
|
||||
@Html.DisplayNameFor(model => model.password)
|
||||
</dt>
|
||||
<dd class = "col-sm-10">
|
||||
@Html.DisplayFor(model => model.password)
|
||||
</dd>
|
||||
<dt class = "col-sm-2">
|
||||
@Html.DisplayNameFor(model => model.icon)
|
||||
</dt>
|
||||
<dd class = "col-sm-10">
|
||||
@Html.DisplayFor(model => model.icon)
|
||||
</dd>
|
||||
<dt class = "col-sm-2">
|
||||
@Html.DisplayNameFor(model => model.nick)
|
||||
</dt>
|
||||
<dd class = "col-sm-10">
|
||||
@Html.DisplayFor(model => model.nick)
|
||||
</dd>
|
||||
<dt class = "col-sm-2">
|
||||
@Html.DisplayNameFor(model => model.email)
|
||||
</dt>
|
||||
<dd class = "col-sm-10">
|
||||
@Html.DisplayFor(model => model.email)
|
||||
</dd>
|
||||
<dt class = "col-sm-2">
|
||||
@Html.DisplayNameFor(model => model.ip)
|
||||
</dt>
|
||||
<dd class = "col-sm-10">
|
||||
@Html.DisplayFor(model => model.ip)
|
||||
</dd>
|
||||
<dt class = "col-sm-2">
|
||||
@Html.DisplayNameFor(model => model.age)
|
||||
</dt>
|
||||
<dd class = "col-sm-10">
|
||||
@Html.DisplayFor(model => model.age)
|
||||
</dd>
|
||||
<dt class = "col-sm-2">
|
||||
@Html.DisplayNameFor(model => model.introduction)
|
||||
</dt>
|
||||
<dd class = "col-sm-10">
|
||||
@Html.DisplayFor(model => model.introduction)
|
||||
</dd>
|
||||
<dt class = "col-sm-2">
|
||||
@Html.DisplayNameFor(model => model.address)
|
||||
</dt>
|
||||
<dd class = "col-sm-10">
|
||||
@Html.DisplayFor(model => model.address)
|
||||
</dd>
|
||||
<dt class = "col-sm-2">
|
||||
@Html.DisplayNameFor(model => model.phone)
|
||||
</dt>
|
||||
<dd class = "col-sm-10">
|
||||
@Html.DisplayFor(model => model.phone)
|
||||
</dd>
|
||||
<dt class = "col-sm-2">
|
||||
@Html.DisplayNameFor(model => model.id)
|
||||
</dt>
|
||||
<dd class = "col-sm-10">
|
||||
@Html.DisplayFor(model => model.id)
|
||||
</dd>
|
||||
<dt class = "col-sm-2">
|
||||
@Html.DisplayNameFor(model => model.is_delete)
|
||||
</dt>
|
||||
<dd class = "col-sm-10">
|
||||
@Html.DisplayFor(model => model.is_delete)
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div>
|
||||
@Html.ActionLink("Edit", "Edit", new { /* id = Model.PrimaryKey */ }) |
|
||||
<a asp-action="Index">Back to List</a>
|
||||
</div>
|
||||
@@ -0,0 +1,18 @@
|
||||
<environment names="Development">
|
||||
<script src="~/lib/jquery-validation/dist/jquery.validate.js"></script>
|
||||
<script src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.js"></script>
|
||||
</environment>
|
||||
<environment names="Staging,Production">
|
||||
<script src="https://ajax.aspnetcdn.com/ajax/jquery.validate/1.17.0/jquery.validate.min.js"
|
||||
asp-fallback-src="~/lib/jquery-validation/dist/jquery.validate.min.js"
|
||||
asp-fallback-test="window.jQuery && window.jQuery.validator"
|
||||
crossorigin="anonymous"
|
||||
integrity="sha384-rZfj/ogBloos6wzLGpPkkOr/gpkBNLZ6b6yLy4o+ok+t/SAKlL5mvXLr0OXNi1Hp">
|
||||
</script>
|
||||
<script src="https://ajax.aspnetcdn.com/ajax/jquery.validation.unobtrusive/3.2.9/jquery.validate.unobtrusive.min.js"
|
||||
asp-fallback-src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js"
|
||||
asp-fallback-test="window.jQuery && window.jQuery.validator && window.jQuery.validator.unobtrusive"
|
||||
crossorigin="anonymous"
|
||||
integrity="sha384-ifv0TYDWxBHzvAk2Z0n8R434FL1Rlv/Av18DXE43N/1rvHyOG4izKst0f2iSLdds">
|
||||
</script>
|
||||
</environment>
|
||||
@@ -0,0 +1,33 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
<DocumentationFile>D:\CC.Yi\CC.Yi\Yi.Framework\Yi.Framework.PageDetail\SwaggerDoc.xml</DocumentationFile>
|
||||
<WarningsAsErrors>;NU1605</WarningsAsErrors>
|
||||
<NoWarn>1701;1702;CS1591</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="5.0.2" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.6.3" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Yi.Framework.Interface\Yi.Framework.Interface.csproj" />
|
||||
<ProjectReference Include="..\Yi.Framework.Model\Yi.Framework.Model.csproj" />
|
||||
<ProjectReference Include="..\Yi.Framework.Service\Yi.Framework.Service.csproj" />
|
||||
<ProjectReference Include="..\Yi.Framework.WebCore\Yi.Framework.WebCore.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Update="Log4net.config">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
|
||||
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
Reference in New Issue
Block a user