From 2bd67778bff6f5860152c78c34cf13bf76c4a4d6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=A9=99=E5=AD=90?= <454313500@qq.com>
Date: Mon, 31 May 2021 21:41:27 +0800
Subject: [PATCH] v3.0.0
v3.0.0
---
CC.Yi.Old/CC.Yi.API/CC.Yi.API.csproj | 50 +++
.../Controllers/StudentController.cs | 175 ++++++++++
.../CC.Yi.API}/Extension/SwaggerExtension.cs | 0
CC.Yi.Old/CC.Yi.API/Filter/DbContextFilter.cs | 22 ++
.../Migrations/20210319112041_yi1.Designer.cs | 40 +++
.../Migrations/20210319112041_yi1.cs | 29 ++
.../Migrations/20210320082935_yi2.Designer.cs | 40 +++
.../Migrations/20210320082935_yi2.cs | 31 ++
.../Migrations/20210325123550_yi3.Designer.cs | 93 ++++++
.../Migrations/20210325123550_yi3.cs | 42 +++
.../Migrations/20210325124241_yi4.Designer.cs | 301 +++++++++++++++++
.../Migrations/20210325124241_yi4.cs | 315 ++++++++++++++++++
.../Migrations/20210410090937_yi5.Designer.cs | 40 +++
.../Migrations/20210410090937_yi5.cs | 220 ++++++++++++
.../Migrations/DataContextModelSnapshot.cs | 10 +-
CC.Yi.Old/CC.Yi.API/Program.cs | 62 ++++
.../CC.Yi.API}/Properties/launchSettings.json | 0
CC.Yi.Old/CC.Yi.API/Startup.cs | 164 +++++++++
.../CC.Yi.API}/T4Startup.cs | 0
.../CC.Yi.API}/T4Startup.tt | 0
.../CC.Yi.API}/appsettings.Development.json | 0
CC.Yi.Old/CC.Yi.API/appsettings.json | 17 +
.../CC.Yi.API}/nlog.config | 0
CC.Yi.Old/CC.Yi.BLL/BaseBll.cs | 109 ++++++
CC.Yi.Old/CC.Yi.BLL/CC.Yi.BLL.csproj | 32 ++
{CC.Yi.BLL => CC.Yi.Old/CC.Yi.BLL}/T4BLL.cs | 4 +-
CC.Yi.Old/CC.Yi.BLL/T4BLL.tt | 37 ++
CC.Yi.Old/CC.Yi.Common/CC.Yi.Common.csproj | 17 +
.../CC.Yi.Common}/Cache/CacheHelper.cs | 0
.../CC.Yi.Common}/Cache/ICacheWriter.cs | 0
CC.Yi.Old/CC.Yi.Common/Cache/RedisCache.cs | 48 +++
.../CC.Yi.Common}/Castle/CustomAutofacAop.cs | 0
.../CC.Yi.Common}/HttpHelper.cs | 0
.../CC.Yi.Common/ImageHelper.cs | 0
CC.Yi.Old/CC.Yi.Common/JsonHelper.cs | 24 ++
.../CC.Yi.Common}/Jwt/JwtConst.cs | 0
CC.Yi.Old/CC.Yi.Common/Result.cs | 40 +++
CC.Yi.Old/CC.Yi.DAL/BaseDal.cs | 113 +++++++
.../CC.Yi.DAL}/CC.Yi.DAL.csproj | 0
CC.Yi.Old/CC.Yi.DAL/DbContentFactory.cs | 58 ++++
CC.Yi.Old/CC.Yi.DAL/T4DAL.cs | 12 +
CC.Yi.Old/CC.Yi.DAL/T4DAL.tt | 30 ++
.../CC.Yi.DALFactory/CC.Yi.DALFactory.csproj | 40 +++
CC.Yi.Old/CC.Yi.DALFactory/DbSession.cs | 45 +++
.../CC.Yi.DALFactory/DbSessionFactory.cs | 35 ++
.../CC.Yi.DALFactory/StaticDalFactory.cs | 24 ++
CC.Yi.Old/CC.Yi.DALFactory/T4DbSession.cs | 18 +
CC.Yi.Old/CC.Yi.DALFactory/T4DbSession.tt | 36 ++
.../CC.Yi.DALFactory/T4StaticDalFactory.cs | 25 ++
.../CC.Yi.DALFactory/T4StaticDalFactory.tt | 43 +++
.../CC.Yi.IBLL}/CC.Yi.IBLL.csproj | 0
CC.Yi.Old/CC.Yi.IBLL/IBaseBll.cs | 78 +++++
.../CC.Yi.IBLL}/T4IBLL.cs | 0
.../CC.Yi.IBLL}/T4IBLL.tt | 0
CC.Yi.Old/CC.Yi.IDAL/CC.Yi.IDAL.csproj | 40 +++
.../CC.Yi.IDAL}/IBaseDal.cs | 0
CC.Yi.Old/CC.Yi.IDAL/IDbSession.cs | 18 +
.../CC.Yi.IDAL}/T4IDAL.cs | 0
.../CC.Yi.IDAL}/T4IDAL.tt | 0
CC.Yi.Old/CC.Yi.IDAL/T4IDbSession.cs | 15 +
CC.Yi.Old/CC.Yi.IDAL/T4IDbSession.tt | 33 ++
CC.Yi.Old/CC.Yi.Model/CC.Yi.Model.csproj | 43 +++
CC.Yi.Old/CC.Yi.Model/DataContext.cs | 14 +
.../CC.Yi.Model}/T4DataContext.cs | 0
.../CC.Yi.Model}/T4DataContext.tt | 0
CC.Yi.Old/CC.Yi.Model/result_user.cs | 13 +
.../CC.Yi.Model}/student.cs | 0
.../CC.Yi.ViewModel}/CC.Yi.ViewModel.csproj | 0
CC.Yi.Old/CC.Yi.sln | 94 ++++++
{T4Model => CC.Yi.Old/T4Model}/T4Model.txt | 0
{T4Model => CC.Yi.Old/T4Model}/说明.txt | 0
.../CC.Yi.API}/CC.Yi.API.csproj | 0
.../Controllers/StudentController.cs | 30 +-
CC.Yi/CC.Yi.API/Extension/SwaggerExtension.cs | 76 +++++
.../CC.Yi.API}/Filter/DbContextFilter.cs | 0
.../Migrations/20210413063257_y1.Designer.cs | 0
.../Migrations/20210413063257_y1.cs | 0
.../Migrations/20210526080428_yi2.Designer.cs | 70 ++++
.../Migrations/20210526080428_yi2.cs | 41 +++
.../Migrations/DataContextModelSnapshot.cs | 68 ++++
{CC.Yi.API => CC.Yi/CC.Yi.API}/Program.cs | 0
.../CC.Yi.API/Properties/launchSettings.json | 31 ++
{CC.Yi.API => CC.Yi/CC.Yi.API}/Startup.cs | 0
CC.Yi/CC.Yi.API/T4Startup.cs | 24 ++
CC.Yi/CC.Yi.API/T4Startup.tt | 40 +++
CC.Yi/CC.Yi.API/YIDB.db | Bin 0 -> 28672 bytes
CC.Yi/CC.Yi.API/YIDB.db-shm | Bin 0 -> 32768 bytes
.../YIDB.db => CC.Yi/CC.Yi.API/YIDB.db-wal | Bin 20480 -> 20632 bytes
CC.Yi/CC.Yi.API/appsettings.Development.json | 9 +
.../CC.Yi.API}/appsettings.json | 0
CC.Yi/CC.Yi.API/nlog.config | 35 ++
{CC.Yi.BLL => CC.Yi/CC.Yi.BLL}/BaseBll.cs | 0
.../CC.Yi.BLL}/CC.Yi.BLL.csproj | 0
CC.Yi/CC.Yi.BLL/T4BLL.cs | 29 ++
{CC.Yi.BLL => CC.Yi/CC.Yi.BLL}/T4BLL.tt | 0
.../CC.Yi.Common}/CC.Yi.Common.csproj | 0
CC.Yi/CC.Yi.Common/Cache/CacheHelper.cs | 51 +++
CC.Yi/CC.Yi.Common/Cache/ICacheWriter.cs | 18 +
.../CC.Yi.Common}/Cache/RedisCache.cs | 0
CC.Yi/CC.Yi.Common/Castle/CustomAutofacAop.cs | 23 ++
CC.Yi/CC.Yi.Common/HttpHelper.cs | 76 +++++
.../CC.Yi.Common}/JsonHelper.cs | 0
CC.Yi/CC.Yi.Common/Jwt/JwtConst.cs | 12 +
.../CC.Yi.Common}/Result.cs | 0
CC.Yi/CC.Yi.Common/imageHelper.cs | 167 ++++++++++
{CC.Yi.DAL => CC.Yi/CC.Yi.DAL}/BaseDal.cs | 0
CC.Yi/CC.Yi.DAL/CC.Yi.DAL.csproj | 31 ++
{CC.Yi.DAL => CC.Yi/CC.Yi.DAL}/T4DAL.cs | 7 +
{CC.Yi.DAL => CC.Yi/CC.Yi.DAL}/T4DAL.tt | 0
CC.Yi/CC.Yi.IBLL/CC.Yi.IBLL.csproj | 32 ++
{CC.Yi.IBLL => CC.Yi/CC.Yi.IBLL}/IBaseBll.cs | 0
CC.Yi/CC.Yi.IBLL/T4IBLL.cs | 14 +
CC.Yi/CC.Yi.IBLL/T4IBLL.tt | 29 ++
.../CC.Yi.IDAL}/CC.Yi.IDAL.csproj | 0
CC.Yi/CC.Yi.IDAL/IBaseDal.cs | 69 ++++
CC.Yi/CC.Yi.IDAL/T4IDAL.cs | 14 +
CC.Yi/CC.Yi.IDAL/T4IDAL.tt | 29 ++
.../CC.Yi.Model}/CC.Yi.Model.csproj | 0
.../CC.Yi.Model}/DataContext.cs | 0
CC.Yi/CC.Yi.Model/T4DataContext.cs | 12 +
CC.Yi/CC.Yi.Model/T4DataContext.tt | 29 ++
CC.Yi/CC.Yi.Model/prop.cs | 17 +
CC.Yi/CC.Yi.Model/student.cs | 17 +
CC.Yi/CC.Yi.ViewModel/CC.Yi.ViewModel.csproj | 8 +
CC.Yi.sln => CC.Yi/CC.Yi.sln | 0
CC.Yi/T4Model/T4Model.txt | 1 +
CC.Yi/T4Model/说明.txt | 5 +
127 files changed, 3895 insertions(+), 8 deletions(-)
create mode 100644 CC.Yi.Old/CC.Yi.API/CC.Yi.API.csproj
create mode 100644 CC.Yi.Old/CC.Yi.API/Controllers/StudentController.cs
rename {CC.Yi.API => CC.Yi.Old/CC.Yi.API}/Extension/SwaggerExtension.cs (100%)
create mode 100644 CC.Yi.Old/CC.Yi.API/Filter/DbContextFilter.cs
create mode 100644 CC.Yi.Old/CC.Yi.API/Migrations/20210319112041_yi1.Designer.cs
create mode 100644 CC.Yi.Old/CC.Yi.API/Migrations/20210319112041_yi1.cs
create mode 100644 CC.Yi.Old/CC.Yi.API/Migrations/20210320082935_yi2.Designer.cs
create mode 100644 CC.Yi.Old/CC.Yi.API/Migrations/20210320082935_yi2.cs
create mode 100644 CC.Yi.Old/CC.Yi.API/Migrations/20210325123550_yi3.Designer.cs
create mode 100644 CC.Yi.Old/CC.Yi.API/Migrations/20210325123550_yi3.cs
create mode 100644 CC.Yi.Old/CC.Yi.API/Migrations/20210325124241_yi4.Designer.cs
create mode 100644 CC.Yi.Old/CC.Yi.API/Migrations/20210325124241_yi4.cs
create mode 100644 CC.Yi.Old/CC.Yi.API/Migrations/20210410090937_yi5.Designer.cs
create mode 100644 CC.Yi.Old/CC.Yi.API/Migrations/20210410090937_yi5.cs
rename {CC.Yi.API => CC.Yi.Old/CC.Yi.API}/Migrations/DataContextModelSnapshot.cs (61%)
create mode 100644 CC.Yi.Old/CC.Yi.API/Program.cs
rename {CC.Yi.API => CC.Yi.Old/CC.Yi.API}/Properties/launchSettings.json (100%)
create mode 100644 CC.Yi.Old/CC.Yi.API/Startup.cs
rename {CC.Yi.API => CC.Yi.Old/CC.Yi.API}/T4Startup.cs (100%)
rename {CC.Yi.API => CC.Yi.Old/CC.Yi.API}/T4Startup.tt (100%)
rename {CC.Yi.API => CC.Yi.Old/CC.Yi.API}/appsettings.Development.json (100%)
create mode 100644 CC.Yi.Old/CC.Yi.API/appsettings.json
rename {CC.Yi.API => CC.Yi.Old/CC.Yi.API}/nlog.config (100%)
create mode 100644 CC.Yi.Old/CC.Yi.BLL/BaseBll.cs
create mode 100644 CC.Yi.Old/CC.Yi.BLL/CC.Yi.BLL.csproj
rename {CC.Yi.BLL => CC.Yi.Old/CC.Yi.BLL}/T4BLL.cs (68%)
create mode 100644 CC.Yi.Old/CC.Yi.BLL/T4BLL.tt
create mode 100644 CC.Yi.Old/CC.Yi.Common/CC.Yi.Common.csproj
rename {CC.Yi.Common => CC.Yi.Old/CC.Yi.Common}/Cache/CacheHelper.cs (100%)
rename {CC.Yi.Common => CC.Yi.Old/CC.Yi.Common}/Cache/ICacheWriter.cs (100%)
create mode 100644 CC.Yi.Old/CC.Yi.Common/Cache/RedisCache.cs
rename {CC.Yi.Common => CC.Yi.Old/CC.Yi.Common}/Castle/CustomAutofacAop.cs (100%)
rename {CC.Yi.Common => CC.Yi.Old/CC.Yi.Common}/HttpHelper.cs (100%)
rename CC.Yi.Common/imageHelper.cs => CC.Yi.Old/CC.Yi.Common/ImageHelper.cs (100%)
create mode 100644 CC.Yi.Old/CC.Yi.Common/JsonHelper.cs
rename {CC.Yi.Common => CC.Yi.Old/CC.Yi.Common}/Jwt/JwtConst.cs (100%)
create mode 100644 CC.Yi.Old/CC.Yi.Common/Result.cs
create mode 100644 CC.Yi.Old/CC.Yi.DAL/BaseDal.cs
rename {CC.Yi.DAL => CC.Yi.Old/CC.Yi.DAL}/CC.Yi.DAL.csproj (100%)
create mode 100644 CC.Yi.Old/CC.Yi.DAL/DbContentFactory.cs
create mode 100644 CC.Yi.Old/CC.Yi.DAL/T4DAL.cs
create mode 100644 CC.Yi.Old/CC.Yi.DAL/T4DAL.tt
create mode 100644 CC.Yi.Old/CC.Yi.DALFactory/CC.Yi.DALFactory.csproj
create mode 100644 CC.Yi.Old/CC.Yi.DALFactory/DbSession.cs
create mode 100644 CC.Yi.Old/CC.Yi.DALFactory/DbSessionFactory.cs
create mode 100644 CC.Yi.Old/CC.Yi.DALFactory/StaticDalFactory.cs
create mode 100644 CC.Yi.Old/CC.Yi.DALFactory/T4DbSession.cs
create mode 100644 CC.Yi.Old/CC.Yi.DALFactory/T4DbSession.tt
create mode 100644 CC.Yi.Old/CC.Yi.DALFactory/T4StaticDalFactory.cs
create mode 100644 CC.Yi.Old/CC.Yi.DALFactory/T4StaticDalFactory.tt
rename {CC.Yi.IBLL => CC.Yi.Old/CC.Yi.IBLL}/CC.Yi.IBLL.csproj (100%)
create mode 100644 CC.Yi.Old/CC.Yi.IBLL/IBaseBll.cs
rename {CC.Yi.IBLL => CC.Yi.Old/CC.Yi.IBLL}/T4IBLL.cs (100%)
rename {CC.Yi.IBLL => CC.Yi.Old/CC.Yi.IBLL}/T4IBLL.tt (100%)
create mode 100644 CC.Yi.Old/CC.Yi.IDAL/CC.Yi.IDAL.csproj
rename {CC.Yi.IDAL => CC.Yi.Old/CC.Yi.IDAL}/IBaseDal.cs (100%)
create mode 100644 CC.Yi.Old/CC.Yi.IDAL/IDbSession.cs
rename {CC.Yi.IDAL => CC.Yi.Old/CC.Yi.IDAL}/T4IDAL.cs (100%)
rename {CC.Yi.IDAL => CC.Yi.Old/CC.Yi.IDAL}/T4IDAL.tt (100%)
create mode 100644 CC.Yi.Old/CC.Yi.IDAL/T4IDbSession.cs
create mode 100644 CC.Yi.Old/CC.Yi.IDAL/T4IDbSession.tt
create mode 100644 CC.Yi.Old/CC.Yi.Model/CC.Yi.Model.csproj
create mode 100644 CC.Yi.Old/CC.Yi.Model/DataContext.cs
rename {CC.Yi.Model => CC.Yi.Old/CC.Yi.Model}/T4DataContext.cs (100%)
rename {CC.Yi.Model => CC.Yi.Old/CC.Yi.Model}/T4DataContext.tt (100%)
create mode 100644 CC.Yi.Old/CC.Yi.Model/result_user.cs
rename {CC.Yi.Model => CC.Yi.Old/CC.Yi.Model}/student.cs (100%)
rename {CC.Yi.ViewModel => CC.Yi.Old/CC.Yi.ViewModel}/CC.Yi.ViewModel.csproj (100%)
create mode 100644 CC.Yi.Old/CC.Yi.sln
rename {T4Model => CC.Yi.Old/T4Model}/T4Model.txt (100%)
rename {T4Model => CC.Yi.Old/T4Model}/说明.txt (100%)
rename {CC.Yi.API => CC.Yi/CC.Yi.API}/CC.Yi.API.csproj (100%)
rename {CC.Yi.API => CC.Yi/CC.Yi.API}/Controllers/StudentController.cs (87%)
create mode 100644 CC.Yi/CC.Yi.API/Extension/SwaggerExtension.cs
rename {CC.Yi.API => CC.Yi/CC.Yi.API}/Filter/DbContextFilter.cs (100%)
rename {CC.Yi.API => CC.Yi/CC.Yi.API}/Migrations/20210413063257_y1.Designer.cs (100%)
rename {CC.Yi.API => CC.Yi/CC.Yi.API}/Migrations/20210413063257_y1.cs (100%)
create mode 100644 CC.Yi/CC.Yi.API/Migrations/20210526080428_yi2.Designer.cs
create mode 100644 CC.Yi/CC.Yi.API/Migrations/20210526080428_yi2.cs
create mode 100644 CC.Yi/CC.Yi.API/Migrations/DataContextModelSnapshot.cs
rename {CC.Yi.API => CC.Yi/CC.Yi.API}/Program.cs (100%)
create mode 100644 CC.Yi/CC.Yi.API/Properties/launchSettings.json
rename {CC.Yi.API => CC.Yi/CC.Yi.API}/Startup.cs (100%)
create mode 100644 CC.Yi/CC.Yi.API/T4Startup.cs
create mode 100644 CC.Yi/CC.Yi.API/T4Startup.tt
create mode 100644 CC.Yi/CC.Yi.API/YIDB.db
create mode 100644 CC.Yi/CC.Yi.API/YIDB.db-shm
rename CC.Yi.API/YIDB.db => CC.Yi/CC.Yi.API/YIDB.db-wal (93%)
create mode 100644 CC.Yi/CC.Yi.API/appsettings.Development.json
rename {CC.Yi.API => CC.Yi/CC.Yi.API}/appsettings.json (100%)
create mode 100644 CC.Yi/CC.Yi.API/nlog.config
rename {CC.Yi.BLL => CC.Yi/CC.Yi.BLL}/BaseBll.cs (100%)
rename {CC.Yi.BLL => CC.Yi/CC.Yi.BLL}/CC.Yi.BLL.csproj (100%)
create mode 100644 CC.Yi/CC.Yi.BLL/T4BLL.cs
rename {CC.Yi.BLL => CC.Yi/CC.Yi.BLL}/T4BLL.tt (100%)
rename {CC.Yi.Common => CC.Yi/CC.Yi.Common}/CC.Yi.Common.csproj (100%)
create mode 100644 CC.Yi/CC.Yi.Common/Cache/CacheHelper.cs
create mode 100644 CC.Yi/CC.Yi.Common/Cache/ICacheWriter.cs
rename {CC.Yi.Common => CC.Yi/CC.Yi.Common}/Cache/RedisCache.cs (100%)
create mode 100644 CC.Yi/CC.Yi.Common/Castle/CustomAutofacAop.cs
create mode 100644 CC.Yi/CC.Yi.Common/HttpHelper.cs
rename {CC.Yi.Common => CC.Yi/CC.Yi.Common}/JsonHelper.cs (100%)
create mode 100644 CC.Yi/CC.Yi.Common/Jwt/JwtConst.cs
rename {CC.Yi.Common => CC.Yi/CC.Yi.Common}/Result.cs (100%)
create mode 100644 CC.Yi/CC.Yi.Common/imageHelper.cs
rename {CC.Yi.DAL => CC.Yi/CC.Yi.DAL}/BaseDal.cs (100%)
create mode 100644 CC.Yi/CC.Yi.DAL/CC.Yi.DAL.csproj
rename {CC.Yi.DAL => CC.Yi/CC.Yi.DAL}/T4DAL.cs (67%)
rename {CC.Yi.DAL => CC.Yi/CC.Yi.DAL}/T4DAL.tt (100%)
create mode 100644 CC.Yi/CC.Yi.IBLL/CC.Yi.IBLL.csproj
rename {CC.Yi.IBLL => CC.Yi/CC.Yi.IBLL}/IBaseBll.cs (100%)
create mode 100644 CC.Yi/CC.Yi.IBLL/T4IBLL.cs
create mode 100644 CC.Yi/CC.Yi.IBLL/T4IBLL.tt
rename {CC.Yi.IDAL => CC.Yi/CC.Yi.IDAL}/CC.Yi.IDAL.csproj (100%)
create mode 100644 CC.Yi/CC.Yi.IDAL/IBaseDal.cs
create mode 100644 CC.Yi/CC.Yi.IDAL/T4IDAL.cs
create mode 100644 CC.Yi/CC.Yi.IDAL/T4IDAL.tt
rename {CC.Yi.Model => CC.Yi/CC.Yi.Model}/CC.Yi.Model.csproj (100%)
rename {CC.Yi.Model => CC.Yi/CC.Yi.Model}/DataContext.cs (100%)
create mode 100644 CC.Yi/CC.Yi.Model/T4DataContext.cs
create mode 100644 CC.Yi/CC.Yi.Model/T4DataContext.tt
create mode 100644 CC.Yi/CC.Yi.Model/prop.cs
create mode 100644 CC.Yi/CC.Yi.Model/student.cs
create mode 100644 CC.Yi/CC.Yi.ViewModel/CC.Yi.ViewModel.csproj
rename CC.Yi.sln => CC.Yi/CC.Yi.sln (100%)
create mode 100644 CC.Yi/T4Model/T4Model.txt
create mode 100644 CC.Yi/T4Model/说明.txt
diff --git a/CC.Yi.Old/CC.Yi.API/CC.Yi.API.csproj b/CC.Yi.Old/CC.Yi.API/CC.Yi.API.csproj
new file mode 100644
index 00000000..6b3e84cf
--- /dev/null
+++ b/CC.Yi.Old/CC.Yi.API/CC.Yi.API.csproj
@@ -0,0 +1,50 @@
+
+
+
+ net5.0
+
+
+
+
+
+
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Always
+
+
+
+
+
+
+
+
+
+ True
+ True
+ T4Startup.tt
+
+
+
+
+
+ TextTemplatingFileGenerator
+ T4Startup.cs
+
+
+
+
diff --git a/CC.Yi.Old/CC.Yi.API/Controllers/StudentController.cs b/CC.Yi.Old/CC.Yi.API/Controllers/StudentController.cs
new file mode 100644
index 00000000..ecbe8d2f
--- /dev/null
+++ b/CC.Yi.Old/CC.Yi.API/Controllers/StudentController.cs
@@ -0,0 +1,175 @@
+using CC.Yi.API.Filter;
+using CC.Yi.Common;
+using CC.Yi.Common.Cache;
+using CC.Yi.Common.Jwt;
+using CC.Yi.IBLL;
+using CC.Yi.Model;
+using Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Identity;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.Extensions.Logging;
+using Microsoft.IdentityModel.Tokens;
+using System;
+using System.Collections.Generic;
+using System.IdentityModel.Tokens.Jwt;
+using System.Linq;
+using System.Security.Claims;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CC.Yi.API.Controllers
+{
+ [ApiController]
+ [Route("[controller]/[action]")]
+ public class StudentController : Controller
+ {
+ private readonly ILogger _logger;//处理日志相关文件
+
+ //private UserManager _userManager;//处理用户相关逻辑:添加密码,修改密码,添加删除角色等等
+ //private SignInManager _signInManager;//处理注册登录的相关逻辑
+
+ private IstudentBll _studentBll;
+ public StudentController(ILogger logger, IstudentBll studentBll)
+ {
+
+ _logger = logger;
+ _logger.LogInformation("现在你进入了StudentController控制器");
+ _studentBll = studentBll;
+ //_userManager = userManager;
+ //_signInManager = signInManager;
+ }
+ #region
+ //关于身份认证配置使用:
+ //在需要身份认证的控制器上打上 [Authorize] 特性标签
+ #endregion
+ //[HttpGet]
+ //public async Task IdentityTest()
+ //{
+ // //用户登入
+ // var data = await _signInManager.PasswordSignInAsync("账号", "密码", false, false); //"是否记住密码","是否登入失败锁定用户"
+ // //用户登出
+ // await _signInManager.SignOutAsync();
+ // //创建用户
+ // var data2 = await _userManager.CreateAsync(new result_user { UserName="账户",Email="邮箱"},"密码");
+ // //获取用户
+ // var data3 = _userManager.Users;//这里可以使用Linq表达式Select
+ // return Ok();
+ //}
+
+ #region
+ //下面,这里是操作reids
+ #endregion
+ [HttpGet]
+ public Result GetReids()
+ {
+ var data = CacheHelper.CacheWriter.GetCache("key01");
+ return Result.Success(data);
+ }
+
+ #region
+ //下面,权限验证
+ #endregion
+
+ //发送令牌
+ [HttpGet]
+ public Result Login(string role)
+ {
+ string userName = "admin";
+ var claims = new[]
+ {
+ new Claim(JwtRegisteredClaimNames.Nbf,$"{new DateTimeOffset(DateTime.Now).ToUnixTimeSeconds()}") ,
+ new Claim (JwtRegisteredClaimNames.Exp,$"{new DateTimeOffset(DateTime.Now.AddMinutes(30)).ToUnixTimeSeconds()}"),
+ new Claim(ClaimTypes.Name, userName),
+ new Claim(ClaimTypes.Role,role)
+
+ };
+ var key = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(JwtConst.SecurityKey));
+ var creds = new SigningCredentials(key, SecurityAlgorithms.HmacSha256);
+
+ var token = new JwtSecurityToken(
+ issuer: JwtConst.Domain,
+ audience: JwtConst.Domain,
+ claims: claims,
+ expires: DateTime.Now.AddMinutes(30),
+ signingCredentials: creds);
+
+ var tokenData= new JwtSecurityTokenHandler().WriteToken(token);
+ return Result.Success("欢迎你!管理员!").SetData(new { token= tokenData });
+ }
+
+ [HttpGet]
+ [Authorize(Policy = "myadmin")]//基于策略的验证
+ public Result MyAdmin()
+ {
+ return Result.Success("欢迎你!管理员!");
+ }
+
+ [HttpGet]
+ [Authorize(Roles ="user")]//基于角色的验证
+ public Result MyUser()
+ {
+ return Result.Success("欢迎你!游客!");
+ }
+
+
+ #region
+ //下面,经典的 增删改查 即为简易--Yi意框架
+ //注意:请确保你的数据库中存在合理的数据
+ #endregion
+ [HttpGet]
+ [DbContextFilter]
+ public async Task GetTest()//查
+ {
+ _logger.LogInformation("调用查方法");
+ var data =await _studentBll.GetAllEntities().ToListAsync();
+ return Result.Success("查询成功").SetData(data);
+ }
+ [HttpGet]
+ [DbContextFilter]
+ public Result AddTest()//增
+ {
+ _logger.LogInformation("调用增方法");
+ List students = new List() {new student { name = "学生a" } ,new student { name="学生d"} };
+ if (_studentBll.Add(students))
+ {
+ return Result.Success("增加成功");
+ }
+ else
+ {
+ return Result.Error("增加失败");
+ }
+
+
+ }
+ [HttpGet]
+ [DbContextFilter]
+ public Result RemoveTest()//删
+ {
+ _logger.LogInformation("调用删方法");
+ if (_studentBll.Delete(u=>u.name=="学生a"))
+ {
+ return Result.Success("删除成功");
+ }
+ else
+ {
+ return Result.Error("删除失败");
+ }
+ }
+ [HttpGet]
+ [DbContextFilter]
+ public Result UpdateTest()//改
+ {
+ _logger.LogInformation("调用改方法");
+ if (_studentBll.Update(new student { id=2, name = "学生a" }, "name"))
+ {
+ return Result.Success("修改成功");
+ }
+ else
+ {
+ return Result.Error("修改失败");
+ }
+
+ }
+ }
+}
diff --git a/CC.Yi.API/Extension/SwaggerExtension.cs b/CC.Yi.Old/CC.Yi.API/Extension/SwaggerExtension.cs
similarity index 100%
rename from CC.Yi.API/Extension/SwaggerExtension.cs
rename to CC.Yi.Old/CC.Yi.API/Extension/SwaggerExtension.cs
diff --git a/CC.Yi.Old/CC.Yi.API/Filter/DbContextFilter.cs b/CC.Yi.Old/CC.Yi.API/Filter/DbContextFilter.cs
new file mode 100644
index 00000000..82fd8aac
--- /dev/null
+++ b/CC.Yi.Old/CC.Yi.API/Filter/DbContextFilter.cs
@@ -0,0 +1,22 @@
+using CC.Yi.DAL;
+using CC.Yi.Model;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Mvc.Filters;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace CC.Yi.API.Filter
+{
+ public class DbContextFilter : ActionFilterAttribute
+ {
+ public override void OnActionExecuting(ActionExecutingContext filterContext)
+ {
+ var cache = filterContext.HttpContext.RequestServices.GetService(typeof(DataContext)) as DataContext;
+ DbContentFactory.Initialize(cache);
+ base.OnActionExecuting(filterContext);
+
+ }
+ }
+}
diff --git a/CC.Yi.Old/CC.Yi.API/Migrations/20210319112041_yi1.Designer.cs b/CC.Yi.Old/CC.Yi.API/Migrations/20210319112041_yi1.Designer.cs
new file mode 100644
index 00000000..fa669c28
--- /dev/null
+++ b/CC.Yi.Old/CC.Yi.API/Migrations/20210319112041_yi1.Designer.cs
@@ -0,0 +1,40 @@
+//
+using CC.Yi.Model;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+
+namespace CC.Yi.API.Migrations
+{
+ [DbContext(typeof(DataContext))]
+ [Migration("20210319112041_yi1")]
+ partial class yi1
+ {
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("Relational:MaxIdentifierLength", 128)
+ .HasAnnotation("ProductVersion", "5.0.4")
+ .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
+
+ modelBuilder.Entity("CC.Yi.Model.student", b =>
+ {
+ b.Property("id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int")
+ .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
+
+ b.Property("name")
+ .HasColumnType("int");
+
+ b.HasKey("id");
+
+ b.ToTable("student");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/CC.Yi.Old/CC.Yi.API/Migrations/20210319112041_yi1.cs b/CC.Yi.Old/CC.Yi.API/Migrations/20210319112041_yi1.cs
new file mode 100644
index 00000000..03299091
--- /dev/null
+++ b/CC.Yi.Old/CC.Yi.API/Migrations/20210319112041_yi1.cs
@@ -0,0 +1,29 @@
+using Microsoft.EntityFrameworkCore.Migrations;
+
+namespace CC.Yi.API.Migrations
+{
+ public partial class yi1 : Migration
+ {
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.CreateTable(
+ name: "student",
+ columns: table => new
+ {
+ id = table.Column(type: "int", nullable: false)
+ .Annotation("SqlServer:Identity", "1, 1"),
+ name = table.Column(type: "int", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_student", x => x.id);
+ });
+ }
+
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropTable(
+ name: "student");
+ }
+ }
+}
diff --git a/CC.Yi.Old/CC.Yi.API/Migrations/20210320082935_yi2.Designer.cs b/CC.Yi.Old/CC.Yi.API/Migrations/20210320082935_yi2.Designer.cs
new file mode 100644
index 00000000..c9bbf025
--- /dev/null
+++ b/CC.Yi.Old/CC.Yi.API/Migrations/20210320082935_yi2.Designer.cs
@@ -0,0 +1,40 @@
+//
+using CC.Yi.Model;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+
+namespace CC.Yi.API.Migrations
+{
+ [DbContext(typeof(DataContext))]
+ [Migration("20210320082935_yi2")]
+ partial class yi2
+ {
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("Relational:MaxIdentifierLength", 128)
+ .HasAnnotation("ProductVersion", "5.0.4")
+ .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
+
+ modelBuilder.Entity("CC.Yi.Model.student", b =>
+ {
+ b.Property("id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int")
+ .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
+
+ b.Property("name")
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("id");
+
+ b.ToTable("student");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/CC.Yi.Old/CC.Yi.API/Migrations/20210320082935_yi2.cs b/CC.Yi.Old/CC.Yi.API/Migrations/20210320082935_yi2.cs
new file mode 100644
index 00000000..6875efa1
--- /dev/null
+++ b/CC.Yi.Old/CC.Yi.API/Migrations/20210320082935_yi2.cs
@@ -0,0 +1,31 @@
+using Microsoft.EntityFrameworkCore.Migrations;
+
+namespace CC.Yi.API.Migrations
+{
+ public partial class yi2 : Migration
+ {
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.AlterColumn(
+ name: "name",
+ table: "student",
+ type: "nvarchar(max)",
+ nullable: true,
+ oldClrType: typeof(int),
+ oldType: "int");
+ }
+
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.AlterColumn(
+ name: "name",
+ table: "student",
+ type: "int",
+ nullable: false,
+ defaultValue: 0,
+ oldClrType: typeof(string),
+ oldType: "nvarchar(max)",
+ oldNullable: true);
+ }
+ }
+}
diff --git a/CC.Yi.Old/CC.Yi.API/Migrations/20210325123550_yi3.Designer.cs b/CC.Yi.Old/CC.Yi.API/Migrations/20210325123550_yi3.Designer.cs
new file mode 100644
index 00000000..2803473c
--- /dev/null
+++ b/CC.Yi.Old/CC.Yi.API/Migrations/20210325123550_yi3.Designer.cs
@@ -0,0 +1,93 @@
+//
+using System;
+using CC.Yi.Model;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+
+namespace CC.Yi.API.Migrations
+{
+ [DbContext(typeof(DataContext))]
+ [Migration("20210325123550_yi3")]
+ partial class yi3
+ {
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("Relational:MaxIdentifierLength", 128)
+ .HasAnnotation("ProductVersion", "5.0.4")
+ .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
+
+ modelBuilder.Entity("CC.Yi.Model.result_user", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("AccessFailedCount")
+ .HasColumnType("int");
+
+ b.Property("ConcurrencyStamp")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Email")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("EmailConfirmed")
+ .HasColumnType("bit");
+
+ b.Property("LockoutEnabled")
+ .HasColumnType("bit");
+
+ b.Property("LockoutEnd")
+ .HasColumnType("datetimeoffset");
+
+ b.Property("NormalizedEmail")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("NormalizedUserName")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("PasswordHash")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("PhoneNumber")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("PhoneNumberConfirmed")
+ .HasColumnType("bit");
+
+ b.Property("SecurityStamp")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("TwoFactorEnabled")
+ .HasColumnType("bit");
+
+ b.Property("UserName")
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("Id");
+
+ b.ToTable("result_user");
+ });
+
+ modelBuilder.Entity("CC.Yi.Model.student", b =>
+ {
+ b.Property("id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int")
+ .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
+
+ b.Property("name")
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("id");
+
+ b.ToTable("student");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/CC.Yi.Old/CC.Yi.API/Migrations/20210325123550_yi3.cs b/CC.Yi.Old/CC.Yi.API/Migrations/20210325123550_yi3.cs
new file mode 100644
index 00000000..ba0128cc
--- /dev/null
+++ b/CC.Yi.Old/CC.Yi.API/Migrations/20210325123550_yi3.cs
@@ -0,0 +1,42 @@
+using System;
+using Microsoft.EntityFrameworkCore.Migrations;
+
+namespace CC.Yi.API.Migrations
+{
+ public partial class yi3 : Migration
+ {
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.CreateTable(
+ name: "result_user",
+ columns: table => new
+ {
+ Id = table.Column(type: "nvarchar(450)", nullable: false),
+ UserName = table.Column(type: "nvarchar(max)", nullable: true),
+ NormalizedUserName = table.Column(type: "nvarchar(max)", nullable: true),
+ Email = table.Column(type: "nvarchar(max)", nullable: true),
+ NormalizedEmail = table.Column(type: "nvarchar(max)", nullable: true),
+ EmailConfirmed = table.Column(type: "bit", nullable: false),
+ PasswordHash = table.Column(type: "nvarchar(max)", nullable: true),
+ SecurityStamp = table.Column(type: "nvarchar(max)", nullable: true),
+ ConcurrencyStamp = table.Column(type: "nvarchar(max)", nullable: true),
+ PhoneNumber = table.Column(type: "nvarchar(max)", nullable: true),
+ PhoneNumberConfirmed = table.Column(type: "bit", nullable: false),
+ TwoFactorEnabled = table.Column(type: "bit", nullable: false),
+ LockoutEnd = table.Column(type: "datetimeoffset", nullable: true),
+ LockoutEnabled = table.Column(type: "bit", nullable: false),
+ AccessFailedCount = table.Column(type: "int", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_result_user", x => x.Id);
+ });
+ }
+
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropTable(
+ name: "result_user");
+ }
+ }
+}
diff --git a/CC.Yi.Old/CC.Yi.API/Migrations/20210325124241_yi4.Designer.cs b/CC.Yi.Old/CC.Yi.API/Migrations/20210325124241_yi4.Designer.cs
new file mode 100644
index 00000000..dff90a75
--- /dev/null
+++ b/CC.Yi.Old/CC.Yi.API/Migrations/20210325124241_yi4.Designer.cs
@@ -0,0 +1,301 @@
+//
+using System;
+using CC.Yi.Model;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+
+namespace CC.Yi.API.Migrations
+{
+ [DbContext(typeof(DataContext))]
+ [Migration("20210325124241_yi4")]
+ partial class yi4
+ {
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("Relational:MaxIdentifierLength", 128)
+ .HasAnnotation("ProductVersion", "5.0.4")
+ .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
+
+ modelBuilder.Entity("CC.Yi.Model.student", b =>
+ {
+ b.Property("id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int")
+ .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
+
+ b.Property("name")
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("id");
+
+ b.ToTable("student");
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Name")
+ .HasMaxLength(256)
+ .HasColumnType("nvarchar(256)");
+
+ b.Property("NormalizedName")
+ .HasMaxLength(256)
+ .HasColumnType("nvarchar(256)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("NormalizedName")
+ .IsUnique()
+ .HasDatabaseName("RoleNameIndex")
+ .HasFilter("[NormalizedName] IS NOT NULL");
+
+ b.ToTable("AspNetRoles");
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int")
+ .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
+
+ b.Property("ClaimType")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("ClaimValue")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("RoleId")
+ .IsRequired()
+ .HasColumnType("nvarchar(450)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("RoleId");
+
+ b.ToTable("AspNetRoleClaims");
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("AccessFailedCount")
+ .HasColumnType("int");
+
+ b.Property("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Discriminator")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Email")
+ .HasMaxLength(256)
+ .HasColumnType("nvarchar(256)");
+
+ b.Property("EmailConfirmed")
+ .HasColumnType("bit");
+
+ b.Property("LockoutEnabled")
+ .HasColumnType("bit");
+
+ b.Property("LockoutEnd")
+ .HasColumnType("datetimeoffset");
+
+ b.Property("NormalizedEmail")
+ .HasMaxLength(256)
+ .HasColumnType("nvarchar(256)");
+
+ b.Property("NormalizedUserName")
+ .HasMaxLength(256)
+ .HasColumnType("nvarchar(256)");
+
+ b.Property("PasswordHash")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("PhoneNumber")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("PhoneNumberConfirmed")
+ .HasColumnType("bit");
+
+ b.Property("SecurityStamp")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("TwoFactorEnabled")
+ .HasColumnType("bit");
+
+ b.Property("UserName")
+ .HasMaxLength(256)
+ .HasColumnType("nvarchar(256)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("NormalizedEmail")
+ .HasDatabaseName("EmailIndex");
+
+ b.HasIndex("NormalizedUserName")
+ .IsUnique()
+ .HasDatabaseName("UserNameIndex")
+ .HasFilter("[NormalizedUserName] IS NOT NULL");
+
+ b.ToTable("AspNetUsers");
+
+ b.HasDiscriminator("Discriminator").HasValue("IdentityUser");
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int")
+ .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
+
+ b.Property("ClaimType")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("ClaimValue")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("UserId")
+ .IsRequired()
+ .HasColumnType("nvarchar(450)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("AspNetUserClaims");
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b =>
+ {
+ b.Property("LoginProvider")
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("ProviderKey")
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("ProviderDisplayName")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("UserId")
+ .IsRequired()
+ .HasColumnType("nvarchar(450)");
+
+ b.HasKey("LoginProvider", "ProviderKey");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("AspNetUserLogins");
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b =>
+ {
+ b.Property("UserId")
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("RoleId")
+ .HasColumnType("nvarchar(450)");
+
+ b.HasKey("UserId", "RoleId");
+
+ b.HasIndex("RoleId");
+
+ b.ToTable("AspNetUserRoles");
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b =>
+ {
+ b.Property("UserId")
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("LoginProvider")
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("Name")
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("Value")
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("UserId", "LoginProvider", "Name");
+
+ b.ToTable("AspNetUserTokens");
+ });
+
+ modelBuilder.Entity("CC.Yi.Model.result_user", b =>
+ {
+ b.HasBaseType("Microsoft.AspNetCore.Identity.IdentityUser");
+
+ b.HasDiscriminator().HasValue("result_user");
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b =>
+ {
+ b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
+ .WithMany()
+ .HasForeignKey("RoleId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b =>
+ {
+ b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
+ .WithMany()
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b =>
+ {
+ b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
+ .WithMany()
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b =>
+ {
+ b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
+ .WithMany()
+ .HasForeignKey("RoleId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
+ .WithMany()
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b =>
+ {
+ b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
+ .WithMany()
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/CC.Yi.Old/CC.Yi.API/Migrations/20210325124241_yi4.cs b/CC.Yi.Old/CC.Yi.API/Migrations/20210325124241_yi4.cs
new file mode 100644
index 00000000..4b105b4d
--- /dev/null
+++ b/CC.Yi.Old/CC.Yi.API/Migrations/20210325124241_yi4.cs
@@ -0,0 +1,315 @@
+using Microsoft.EntityFrameworkCore.Migrations;
+
+namespace CC.Yi.API.Migrations
+{
+ public partial class yi4 : Migration
+ {
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropPrimaryKey(
+ name: "PK_result_user",
+ table: "result_user");
+
+ migrationBuilder.RenameTable(
+ name: "result_user",
+ newName: "AspNetUsers");
+
+ migrationBuilder.AlterColumn(
+ name: "UserName",
+ table: "AspNetUsers",
+ type: "nvarchar(256)",
+ maxLength: 256,
+ nullable: true,
+ oldClrType: typeof(string),
+ oldType: "nvarchar(max)",
+ oldNullable: true);
+
+ migrationBuilder.AlterColumn(
+ name: "NormalizedUserName",
+ table: "AspNetUsers",
+ type: "nvarchar(256)",
+ maxLength: 256,
+ nullable: true,
+ oldClrType: typeof(string),
+ oldType: "nvarchar(max)",
+ oldNullable: true);
+
+ migrationBuilder.AlterColumn(
+ name: "NormalizedEmail",
+ table: "AspNetUsers",
+ type: "nvarchar(256)",
+ maxLength: 256,
+ nullable: true,
+ oldClrType: typeof(string),
+ oldType: "nvarchar(max)",
+ oldNullable: true);
+
+ migrationBuilder.AlterColumn(
+ name: "Email",
+ table: "AspNetUsers",
+ type: "nvarchar(256)",
+ maxLength: 256,
+ nullable: true,
+ oldClrType: typeof(string),
+ oldType: "nvarchar(max)",
+ oldNullable: true);
+
+ migrationBuilder.AddColumn(
+ name: "Discriminator",
+ table: "AspNetUsers",
+ type: "nvarchar(max)",
+ nullable: false,
+ defaultValue: "");
+
+ migrationBuilder.AddPrimaryKey(
+ name: "PK_AspNetUsers",
+ table: "AspNetUsers",
+ column: "Id");
+
+ migrationBuilder.CreateTable(
+ name: "AspNetRoles",
+ columns: table => new
+ {
+ Id = table.Column(type: "nvarchar(450)", nullable: false),
+ Name = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true),
+ NormalizedName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true),
+ ConcurrencyStamp = table.Column(type: "nvarchar(max)", nullable: true)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_AspNetRoles", x => x.Id);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "AspNetUserClaims",
+ columns: table => new
+ {
+ Id = table.Column(type: "int", nullable: false)
+ .Annotation("SqlServer:Identity", "1, 1"),
+ UserId = table.Column(type: "nvarchar(450)", nullable: false),
+ ClaimType = table.Column(type: "nvarchar(max)", nullable: true),
+ ClaimValue = table.Column(type: "nvarchar(max)", nullable: true)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_AspNetUserClaims", x => x.Id);
+ table.ForeignKey(
+ name: "FK_AspNetUserClaims_AspNetUsers_UserId",
+ column: x => x.UserId,
+ principalTable: "AspNetUsers",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "AspNetUserLogins",
+ columns: table => new
+ {
+ LoginProvider = table.Column(type: "nvarchar(450)", nullable: false),
+ ProviderKey = table.Column(type: "nvarchar(450)", nullable: false),
+ ProviderDisplayName = table.Column(type: "nvarchar(max)", nullable: true),
+ UserId = table.Column(type: "nvarchar(450)", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_AspNetUserLogins", x => new { x.LoginProvider, x.ProviderKey });
+ table.ForeignKey(
+ name: "FK_AspNetUserLogins_AspNetUsers_UserId",
+ column: x => x.UserId,
+ principalTable: "AspNetUsers",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "AspNetUserTokens",
+ columns: table => new
+ {
+ UserId = table.Column(type: "nvarchar(450)", nullable: false),
+ LoginProvider = table.Column(type: "nvarchar(450)", nullable: false),
+ Name = table.Column(type: "nvarchar(450)", nullable: false),
+ Value = table.Column(type: "nvarchar(max)", nullable: true)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_AspNetUserTokens", x => new { x.UserId, x.LoginProvider, x.Name });
+ table.ForeignKey(
+ name: "FK_AspNetUserTokens_AspNetUsers_UserId",
+ column: x => x.UserId,
+ principalTable: "AspNetUsers",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "AspNetRoleClaims",
+ columns: table => new
+ {
+ Id = table.Column(type: "int", nullable: false)
+ .Annotation("SqlServer:Identity", "1, 1"),
+ RoleId = table.Column(type: "nvarchar(450)", nullable: false),
+ ClaimType = table.Column(type: "nvarchar(max)", nullable: true),
+ ClaimValue = table.Column(type: "nvarchar(max)", nullable: true)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_AspNetRoleClaims", x => x.Id);
+ table.ForeignKey(
+ name: "FK_AspNetRoleClaims_AspNetRoles_RoleId",
+ column: x => x.RoleId,
+ principalTable: "AspNetRoles",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "AspNetUserRoles",
+ columns: table => new
+ {
+ UserId = table.Column(type: "nvarchar(450)", nullable: false),
+ RoleId = table.Column(type: "nvarchar(450)", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_AspNetUserRoles", x => new { x.UserId, x.RoleId });
+ table.ForeignKey(
+ name: "FK_AspNetUserRoles_AspNetRoles_RoleId",
+ column: x => x.RoleId,
+ principalTable: "AspNetRoles",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ table.ForeignKey(
+ name: "FK_AspNetUserRoles_AspNetUsers_UserId",
+ column: x => x.UserId,
+ principalTable: "AspNetUsers",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ });
+
+ migrationBuilder.CreateIndex(
+ name: "EmailIndex",
+ table: "AspNetUsers",
+ column: "NormalizedEmail");
+
+ migrationBuilder.CreateIndex(
+ name: "UserNameIndex",
+ table: "AspNetUsers",
+ column: "NormalizedUserName",
+ unique: true,
+ filter: "[NormalizedUserName] IS NOT NULL");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_AspNetRoleClaims_RoleId",
+ table: "AspNetRoleClaims",
+ column: "RoleId");
+
+ migrationBuilder.CreateIndex(
+ name: "RoleNameIndex",
+ table: "AspNetRoles",
+ column: "NormalizedName",
+ unique: true,
+ filter: "[NormalizedName] IS NOT NULL");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_AspNetUserClaims_UserId",
+ table: "AspNetUserClaims",
+ column: "UserId");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_AspNetUserLogins_UserId",
+ table: "AspNetUserLogins",
+ column: "UserId");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_AspNetUserRoles_RoleId",
+ table: "AspNetUserRoles",
+ column: "RoleId");
+ }
+
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropTable(
+ name: "AspNetRoleClaims");
+
+ migrationBuilder.DropTable(
+ name: "AspNetUserClaims");
+
+ migrationBuilder.DropTable(
+ name: "AspNetUserLogins");
+
+ migrationBuilder.DropTable(
+ name: "AspNetUserRoles");
+
+ migrationBuilder.DropTable(
+ name: "AspNetUserTokens");
+
+ migrationBuilder.DropTable(
+ name: "AspNetRoles");
+
+ migrationBuilder.DropPrimaryKey(
+ name: "PK_AspNetUsers",
+ table: "AspNetUsers");
+
+ migrationBuilder.DropIndex(
+ name: "EmailIndex",
+ table: "AspNetUsers");
+
+ migrationBuilder.DropIndex(
+ name: "UserNameIndex",
+ table: "AspNetUsers");
+
+ migrationBuilder.DropColumn(
+ name: "Discriminator",
+ table: "AspNetUsers");
+
+ migrationBuilder.RenameTable(
+ name: "AspNetUsers",
+ newName: "result_user");
+
+ migrationBuilder.AlterColumn(
+ name: "UserName",
+ table: "result_user",
+ type: "nvarchar(max)",
+ nullable: true,
+ oldClrType: typeof(string),
+ oldType: "nvarchar(256)",
+ oldMaxLength: 256,
+ oldNullable: true);
+
+ migrationBuilder.AlterColumn(
+ name: "NormalizedUserName",
+ table: "result_user",
+ type: "nvarchar(max)",
+ nullable: true,
+ oldClrType: typeof(string),
+ oldType: "nvarchar(256)",
+ oldMaxLength: 256,
+ oldNullable: true);
+
+ migrationBuilder.AlterColumn(
+ name: "NormalizedEmail",
+ table: "result_user",
+ type: "nvarchar(max)",
+ nullable: true,
+ oldClrType: typeof(string),
+ oldType: "nvarchar(256)",
+ oldMaxLength: 256,
+ oldNullable: true);
+
+ migrationBuilder.AlterColumn(
+ name: "Email",
+ table: "result_user",
+ type: "nvarchar(max)",
+ nullable: true,
+ oldClrType: typeof(string),
+ oldType: "nvarchar(256)",
+ oldMaxLength: 256,
+ oldNullable: true);
+
+ migrationBuilder.AddPrimaryKey(
+ name: "PK_result_user",
+ table: "result_user",
+ column: "Id");
+ }
+ }
+}
diff --git a/CC.Yi.Old/CC.Yi.API/Migrations/20210410090937_yi5.Designer.cs b/CC.Yi.Old/CC.Yi.API/Migrations/20210410090937_yi5.Designer.cs
new file mode 100644
index 00000000..6038f52c
--- /dev/null
+++ b/CC.Yi.Old/CC.Yi.API/Migrations/20210410090937_yi5.Designer.cs
@@ -0,0 +1,40 @@
+//
+using CC.Yi.Model;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+
+namespace CC.Yi.API.Migrations
+{
+ [DbContext(typeof(DataContext))]
+ [Migration("20210410090937_yi5")]
+ partial class yi5
+ {
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("Relational:MaxIdentifierLength", 128)
+ .HasAnnotation("ProductVersion", "5.0.4")
+ .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
+
+ modelBuilder.Entity("CC.Yi.Model.student", b =>
+ {
+ b.Property("id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int")
+ .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
+
+ b.Property("name")
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("id");
+
+ b.ToTable("student");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/CC.Yi.Old/CC.Yi.API/Migrations/20210410090937_yi5.cs b/CC.Yi.Old/CC.Yi.API/Migrations/20210410090937_yi5.cs
new file mode 100644
index 00000000..73cf0845
--- /dev/null
+++ b/CC.Yi.Old/CC.Yi.API/Migrations/20210410090937_yi5.cs
@@ -0,0 +1,220 @@
+using System;
+using Microsoft.EntityFrameworkCore.Migrations;
+
+namespace CC.Yi.API.Migrations
+{
+ public partial class yi5 : Migration
+ {
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropTable(
+ name: "AspNetRoleClaims");
+
+ migrationBuilder.DropTable(
+ name: "AspNetUserClaims");
+
+ migrationBuilder.DropTable(
+ name: "AspNetUserLogins");
+
+ migrationBuilder.DropTable(
+ name: "AspNetUserRoles");
+
+ migrationBuilder.DropTable(
+ name: "AspNetUserTokens");
+
+ migrationBuilder.DropTable(
+ name: "AspNetRoles");
+
+ migrationBuilder.DropTable(
+ name: "AspNetUsers");
+ }
+
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.CreateTable(
+ name: "AspNetRoles",
+ columns: table => new
+ {
+ Id = table.Column(type: "nvarchar(450)", nullable: false),
+ ConcurrencyStamp = table.Column(type: "nvarchar(max)", nullable: true),
+ Name = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true),
+ NormalizedName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_AspNetRoles", x => x.Id);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "AspNetUsers",
+ columns: table => new
+ {
+ Id = table.Column(type: "nvarchar(450)", nullable: false),
+ AccessFailedCount = table.Column(type: "int", nullable: false),
+ ConcurrencyStamp = table.Column(type: "nvarchar(max)", nullable: true),
+ Discriminator = table.Column(type: "nvarchar(max)", nullable: false),
+ Email = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true),
+ EmailConfirmed = table.Column(type: "bit", nullable: false),
+ LockoutEnabled = table.Column(type: "bit", nullable: false),
+ LockoutEnd = table.Column(type: "datetimeoffset", nullable: true),
+ NormalizedEmail = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true),
+ NormalizedUserName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true),
+ PasswordHash = table.Column(type: "nvarchar(max)", nullable: true),
+ PhoneNumber = table.Column(type: "nvarchar(max)", nullable: true),
+ PhoneNumberConfirmed = table.Column(type: "bit", nullable: false),
+ SecurityStamp = table.Column(type: "nvarchar(max)", nullable: true),
+ TwoFactorEnabled = table.Column(type: "bit", nullable: false),
+ UserName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_AspNetUsers", x => x.Id);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "AspNetRoleClaims",
+ columns: table => new
+ {
+ Id = table.Column(type: "int", nullable: false)
+ .Annotation("SqlServer:Identity", "1, 1"),
+ ClaimType = table.Column(type: "nvarchar(max)", nullable: true),
+ ClaimValue = table.Column(type: "nvarchar(max)", nullable: true),
+ RoleId = table.Column(type: "nvarchar(450)", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_AspNetRoleClaims", x => x.Id);
+ table.ForeignKey(
+ name: "FK_AspNetRoleClaims_AspNetRoles_RoleId",
+ column: x => x.RoleId,
+ principalTable: "AspNetRoles",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "AspNetUserClaims",
+ columns: table => new
+ {
+ Id = table.Column(type: "int", nullable: false)
+ .Annotation("SqlServer:Identity", "1, 1"),
+ ClaimType = table.Column(type: "nvarchar(max)", nullable: true),
+ ClaimValue = table.Column(type: "nvarchar(max)", nullable: true),
+ UserId = table.Column(type: "nvarchar(450)", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_AspNetUserClaims", x => x.Id);
+ table.ForeignKey(
+ name: "FK_AspNetUserClaims_AspNetUsers_UserId",
+ column: x => x.UserId,
+ principalTable: "AspNetUsers",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "AspNetUserLogins",
+ columns: table => new
+ {
+ LoginProvider = table.Column(type: "nvarchar(450)", nullable: false),
+ ProviderKey = table.Column(type: "nvarchar(450)", nullable: false),
+ ProviderDisplayName = table.Column(type: "nvarchar(max)", nullable: true),
+ UserId = table.Column(type: "nvarchar(450)", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_AspNetUserLogins", x => new { x.LoginProvider, x.ProviderKey });
+ table.ForeignKey(
+ name: "FK_AspNetUserLogins_AspNetUsers_UserId",
+ column: x => x.UserId,
+ principalTable: "AspNetUsers",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "AspNetUserRoles",
+ columns: table => new
+ {
+ UserId = table.Column(type: "nvarchar(450)", nullable: false),
+ RoleId = table.Column(type: "nvarchar(450)", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_AspNetUserRoles", x => new { x.UserId, x.RoleId });
+ table.ForeignKey(
+ name: "FK_AspNetUserRoles_AspNetRoles_RoleId",
+ column: x => x.RoleId,
+ principalTable: "AspNetRoles",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ table.ForeignKey(
+ name: "FK_AspNetUserRoles_AspNetUsers_UserId",
+ column: x => x.UserId,
+ principalTable: "AspNetUsers",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "AspNetUserTokens",
+ columns: table => new
+ {
+ UserId = table.Column(type: "nvarchar(450)", nullable: false),
+ LoginProvider = table.Column(type: "nvarchar(450)", nullable: false),
+ Name = table.Column(type: "nvarchar(450)", nullable: false),
+ Value = table.Column(type: "nvarchar(max)", nullable: true)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_AspNetUserTokens", x => new { x.UserId, x.LoginProvider, x.Name });
+ table.ForeignKey(
+ name: "FK_AspNetUserTokens_AspNetUsers_UserId",
+ column: x => x.UserId,
+ principalTable: "AspNetUsers",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ });
+
+ migrationBuilder.CreateIndex(
+ name: "IX_AspNetRoleClaims_RoleId",
+ table: "AspNetRoleClaims",
+ column: "RoleId");
+
+ migrationBuilder.CreateIndex(
+ name: "RoleNameIndex",
+ table: "AspNetRoles",
+ column: "NormalizedName",
+ unique: true,
+ filter: "[NormalizedName] IS NOT NULL");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_AspNetUserClaims_UserId",
+ table: "AspNetUserClaims",
+ column: "UserId");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_AspNetUserLogins_UserId",
+ table: "AspNetUserLogins",
+ column: "UserId");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_AspNetUserRoles_RoleId",
+ table: "AspNetUserRoles",
+ column: "RoleId");
+
+ migrationBuilder.CreateIndex(
+ name: "EmailIndex",
+ table: "AspNetUsers",
+ column: "NormalizedEmail");
+
+ migrationBuilder.CreateIndex(
+ name: "UserNameIndex",
+ table: "AspNetUsers",
+ column: "NormalizedUserName",
+ unique: true,
+ filter: "[NormalizedUserName] IS NOT NULL");
+ }
+ }
+}
diff --git a/CC.Yi.API/Migrations/DataContextModelSnapshot.cs b/CC.Yi.Old/CC.Yi.API/Migrations/DataContextModelSnapshot.cs
similarity index 61%
rename from CC.Yi.API/Migrations/DataContextModelSnapshot.cs
rename to CC.Yi.Old/CC.Yi.API/Migrations/DataContextModelSnapshot.cs
index d49b625c..1952adda 100644
--- a/CC.Yi.API/Migrations/DataContextModelSnapshot.cs
+++ b/CC.Yi.Old/CC.Yi.API/Migrations/DataContextModelSnapshot.cs
@@ -2,6 +2,7 @@
using CC.Yi.Model;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace CC.Yi.API.Migrations
@@ -13,16 +14,19 @@ namespace CC.Yi.API.Migrations
{
#pragma warning disable 612, 618
modelBuilder
- .HasAnnotation("ProductVersion", "5.0.5");
+ .HasAnnotation("Relational:MaxIdentifierLength", 128)
+ .HasAnnotation("ProductVersion", "5.0.4")
+ .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("CC.Yi.Model.student", b =>
{
b.Property("id")
.ValueGeneratedOnAdd()
- .HasColumnType("INTEGER");
+ .HasColumnType("int")
+ .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property("name")
- .HasColumnType("TEXT");
+ .HasColumnType("nvarchar(max)");
b.HasKey("id");
diff --git a/CC.Yi.Old/CC.Yi.API/Program.cs b/CC.Yi.Old/CC.Yi.API/Program.cs
new file mode 100644
index 00000000..9fe2b1eb
--- /dev/null
+++ b/CC.Yi.Old/CC.Yi.API/Program.cs
@@ -0,0 +1,62 @@
+using Autofac.Extensions.DependencyInjection;
+using CC.Yi.DAL;
+using Microsoft.AspNetCore.Hosting;
+using Microsoft.Extensions.Configuration;
+using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.Hosting;
+using Microsoft.Extensions.Logging;
+using NLog.Web;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace CC.Yi.API
+{
+ public class Program
+ {
+ public static void Main(string[] args)
+ {
+ var logger = NLog.Web.NLogBuilder.ConfigureNLog("nlog.config").GetCurrentClassLogger();
+ try
+ {
+ logger.Debug("Yiܡ");
+ var host = CreateHostBuilder(args).Build();
+ //var scope = host.Services.CreateScope();
+ //var services = scope.ServiceProvider;
+ //var context = services.GetRequiredService();//ȡ
+ //DbContentFactory.Initialize(context);//þ̬ע
+ host.Run();
+ logger.Info("Yiɹ");
+ }
+ catch (Exception exception)
+ {
+ //NLog: catch setup errors
+ logger.Error(exception, "Stopped program because of exception");
+ throw;
+ }
+ finally
+ {
+ // Ensure to flush and stop internal timers/threads before application-exit (Avoid segmentation fault on Linux)
+ NLog.LogManager.Shutdown();
+ }
+
+
+
+
+ }
+
+ public static IHostBuilder CreateHostBuilder(string[] args) =>
+ Host.CreateDefaultBuilder(args)
+ .ConfigureWebHostDefaults(webBuilder =>
+ {
+ webBuilder.UseStartup();
+ }).UseServiceProviderFactory(new AutofacServiceProviderFactory())
+ .ConfigureLogging(logging =>
+ {
+ // logging.ClearProviders(); // п̨
+ logging.SetMinimumLevel(Microsoft.Extensions.Logging.LogLevel.Trace);
+ }).UseNLog();//nlog־
+
+ }
+}
diff --git a/CC.Yi.API/Properties/launchSettings.json b/CC.Yi.Old/CC.Yi.API/Properties/launchSettings.json
similarity index 100%
rename from CC.Yi.API/Properties/launchSettings.json
rename to CC.Yi.Old/CC.Yi.API/Properties/launchSettings.json
diff --git a/CC.Yi.Old/CC.Yi.API/Startup.cs b/CC.Yi.Old/CC.Yi.API/Startup.cs
new file mode 100644
index 00000000..55003dc4
--- /dev/null
+++ b/CC.Yi.Old/CC.Yi.API/Startup.cs
@@ -0,0 +1,164 @@
+
+using Autofac;
+using Autofac.Extras.DynamicProxy;
+using CC.Yi.API.Extension;
+using CC.Yi.API.Filter;
+using CC.Yi.BLL;
+using CC.Yi.Common.Cache;
+using CC.Yi.Common.Castle;
+using CC.Yi.Common.Jwt;
+using CC.Yi.DAL;
+using CC.Yi.IBLL;
+using CC.Yi.IDAL;
+using CC.Yi.Model;
+using Microsoft.AspNetCore.Authentication.JwtBearer;
+using Microsoft.AspNetCore.Builder;
+using Microsoft.AspNetCore.Hosting;
+using Microsoft.AspNetCore.HttpsPolicy;
+using Microsoft.AspNetCore.Identity;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.Extensions.Configuration;
+using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.Hosting;
+using Microsoft.Extensions.Logging;
+using Microsoft.IdentityModel.Tokens;
+using Microsoft.OpenApi.Models;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CC.Yi.API
+{
+ public partial class Startup
+ {
+ public Startup(IConfiguration configuration)
+ {
+ Configuration = configuration;
+ }
+
+ public IConfiguration Configuration { get; }
+
+
+ public void ConfigureServices(IServiceCollection services)
+ {
+ // Jwt
+ services.AddAuthorization(options =>
+ {
+ //ûڲԵ֤
+ options.AddPolicy("myadmin", policy =>
+ policy.RequireRole("admin"));
+ });
+
+
+ services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
+ .AddJwtBearer(options => {
+ options.TokenValidationParameters = new TokenValidationParameters
+ {
+ ValidateIssuer = true,//Ƿ֤Issuer
+ ValidateAudience = true,//Ƿ֤Audience
+ ValidateLifetime = true,//Ƿ֤ʧЧʱ
+ ClockSkew = TimeSpan.FromSeconds(30),
+ ValidateIssuerSigningKey = true,//Ƿ֤SecurityKey
+ ValidAudience = JwtConst.Domain,//Audience
+ ValidIssuer = JwtConst.Domain,//Issuerǰǩjwtһ
+ IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(JwtConst.SecurityKey))//õSecurityKey
+ };
+ });
+
+
+ services.AddControllers();
+ services.AddSwaggerService();
+ services.AddSession();
+
+
+
+ //ù
+ Action filters = new Action(r => {
+ //r.Filters.Add(typeof(DbContextFilter));
+ });
+ services.AddMvc(filters);
+
+ //ݿ
+ string connection1 = Configuration["ConnectionStringBySQL"];
+ string connection2 = Configuration["ConnectionStringByMySQL"];
+ string connection3 = Configuration["ConnectionStringBySQLite"];
+ services.AddDbContext(options =>
+ {
+ options.UseSqlServer(connection1, b => b.MigrationsAssembly("CC.Yi.API"));//ݿ
+ });
+
+
+ //עתAutofac
+ //services.AddScoped(typeof(IBaseDal<>), typeof(BaseDal<>));
+ //services.AddScoped(typeof(IstudentBll), typeof(studentBll));
+
+ //reidsע
+ //services.AddSingleton(typeof(ICacheWriter), new RedisCacheService(new Microsoft.Extensions.Caching.Redis.RedisCacheOptions()
+ //{
+ // Configuration = Configuration.GetSection("Cache.ConnectionString").Value,
+ // InstanceName = Configuration.GetSection("Cache.InstanceName").Value
+ //}));
+
+
+ //Identity֤
+ //services.AddIdentity(options =>
+ // {
+ // options.Password.RequiredLength = 6;//̳
+ // options.Password.RequireDigit = false;//
+ // options.Password.RequireLowercase = false;//Сдĸ
+ // options.Password.RequireNonAlphanumeric = false;//ַ
+ // options.Password.RequireUppercase = false;//дĸ
+ // //options.User.RequireUniqueEmail = false;//עǷԲظ
+ // //options.User.AllowedUserNameCharacters="abcd"//ַֻ
+ //}).AddEntityFrameworkStores().AddDefaultTokenProviders();
+
+ //
+ services.AddCors(options => options.AddPolicy("CorsPolicy",
+ builder =>
+ {
+ builder.AllowAnyMethod()
+ .SetIsOriginAllowed(_ => true)
+ .AllowAnyHeader()
+ .AllowCredentials();
+ }));
+ }
+
+ //ʼʹú
+ private void InitData(IServiceProvider serviceProvider)
+ {
+ //var serviceScope = serviceProvider.GetRequiredService().CreateScope();
+
+ //var context = serviceScope.ServiceProvider.GetService();
+ //DbContentFactory.Initialize(context);//þ̬ע
+ }
+
+
+
+ public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
+ {
+
+ if (env.IsDevelopment())
+ {
+ app.UseDeveloperExceptionPage();
+ app.UseSwaggerService();
+ }
+
+ //app.UseAuthentication();
+ app.UseCors("CorsPolicy");
+ app.UseHttpsRedirection();
+ app.UseSession();
+ app.UseRouting();
+ app.UseAuthentication();
+ app.UseAuthorization();
+
+ app.UseEndpoints(endpoints =>
+ {
+ endpoints.MapControllers();
+ });
+ InitData(app.ApplicationServices);
+ }
+ }
+}
diff --git a/CC.Yi.API/T4Startup.cs b/CC.Yi.Old/CC.Yi.API/T4Startup.cs
similarity index 100%
rename from CC.Yi.API/T4Startup.cs
rename to CC.Yi.Old/CC.Yi.API/T4Startup.cs
diff --git a/CC.Yi.API/T4Startup.tt b/CC.Yi.Old/CC.Yi.API/T4Startup.tt
similarity index 100%
rename from CC.Yi.API/T4Startup.tt
rename to CC.Yi.Old/CC.Yi.API/T4Startup.tt
diff --git a/CC.Yi.API/appsettings.Development.json b/CC.Yi.Old/CC.Yi.API/appsettings.Development.json
similarity index 100%
rename from CC.Yi.API/appsettings.Development.json
rename to CC.Yi.Old/CC.Yi.API/appsettings.Development.json
diff --git a/CC.Yi.Old/CC.Yi.API/appsettings.json b/CC.Yi.Old/CC.Yi.API/appsettings.json
new file mode 100644
index 00000000..429d06ac
--- /dev/null
+++ b/CC.Yi.Old/CC.Yi.API/appsettings.json
@@ -0,0 +1,17 @@
+{
+ "Logging": {
+ "LogLevel": {
+ "Default": "Information",
+ "Microsoft": "Warning",
+ "Microsoft.Hosting.Lifetime": "Information"
+ }
+ },
+ "AllowedHosts": "*",
+ "Cache": {
+ "InstanceName": "Redis",
+ "ConnectionString": "127.0.0.1:12345,password=123456"
+ },
+ "ConnectionStringBySQL": "server=.;Database=YIDB;UId=sa;PWD=Qz52013142020.",
+ "ConnectionStringByMySQL": "Data Source=.;Database=YIDB;User ID=root;Password=Qz52013142020.;pooling=true;port=3306;sslmode=none;CharSet=utf8;",
+ "ConnectionStringBySQLite": "Filename=YIDB.db"
+}
diff --git a/CC.Yi.API/nlog.config b/CC.Yi.Old/CC.Yi.API/nlog.config
similarity index 100%
rename from CC.Yi.API/nlog.config
rename to CC.Yi.Old/CC.Yi.API/nlog.config
diff --git a/CC.Yi.Old/CC.Yi.BLL/BaseBll.cs b/CC.Yi.Old/CC.Yi.BLL/BaseBll.cs
new file mode 100644
index 00000000..90cd98a0
--- /dev/null
+++ b/CC.Yi.Old/CC.Yi.BLL/BaseBll.cs
@@ -0,0 +1,109 @@
+using CC.Yi.DALFactory;
+using CC.Yi.IBLL;
+using CC.Yi.IDAL;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Linq.Expressions;
+
+namespace CC.Yi.BLL
+{
+ public class BaseBll : IBaseBll where T : class, new()
+ {
+ public IBaseDal CurrentDal;
+ public BaseBll(IBaseDal cd)
+ {
+ CurrentDal = cd;
+ }
+
+ public IQueryable GetAllEntities()
+ {
+ return CurrentDal.GetAllEntities();
+ }
+
+ public IQueryable GetEntities(Expression> whereLambda)
+ {
+ return CurrentDal.GetEntities(whereLambda);
+ }
+
+ public int GetCount(Expression> whereLambda) //统计数量
+ {
+ return CurrentDal.GetCount(whereLambda);
+ }
+
+ public IQueryable> GetGroup(Expression> whereLambda, Expression> groupByLambda) //分组
+ {
+ return CurrentDal.GetGroup(whereLambda, groupByLambda);
+
+ }
+
+
+ public IQueryable GetPageEntities(int pageSize, int pageIndex, out int total, Expression> whereLambda, Expression> orderByLambda, bool isAsc)
+ {
+ return CurrentDal.GetPageEntities(pageSize, pageIndex, out total, whereLambda, orderByLambda, isAsc);
+ }
+
+ public T Add(T entity)
+ {
+ var myEntity=CurrentDal.Add(entity);
+ DbSession.SaveChanges();
+ return myEntity;
+ }
+
+ public bool Add(IEnumerable entities)
+ {
+ CurrentDal.AddRange(entities);
+ return DbSession.SaveChanges() > 0;
+ }
+
+ public bool Update(T entity)
+ {
+ CurrentDal.Update(entity);
+ return DbSession.SaveChanges() > 0;
+ }
+
+ public bool Update(T entity, params string[] propertyNames)
+ {
+ CurrentDal.Update(entity,propertyNames);
+ return DbSession.SaveChanges() > 0;
+ }
+
+ public bool Delete(T entity)
+ {
+ CurrentDal.Delete(entity);
+ return DbSession.SaveChanges() > 0;
+ }
+ public IDbSession DbSession
+ {
+ get
+ {
+ return DbSessionFactory.GetCurrentDbSession();
+ }
+ }
+ public bool Delete(int id)
+ {
+ CurrentDal.Detete(id);
+ return DbSession.SaveChanges() > 0;
+ }
+
+ public bool Delete(IEnumerable ids)
+ {
+ foreach (var id in ids)
+ {
+ CurrentDal.Detete(id);
+ }
+ return DbSession.SaveChanges()>0;
+ }
+ public bool Delete(Expression> where)
+ {
+ IQueryable entities = CurrentDal.GetEntities(where);
+ if (entities != null)
+ {
+ CurrentDal.DeteteRange(entities);
+
+ return DbSession.SaveChanges()>0;
+ }
+ return false;
+ }
+ }
+}
diff --git a/CC.Yi.Old/CC.Yi.BLL/CC.Yi.BLL.csproj b/CC.Yi.Old/CC.Yi.BLL/CC.Yi.BLL.csproj
new file mode 100644
index 00000000..ce6c0299
--- /dev/null
+++ b/CC.Yi.Old/CC.Yi.BLL/CC.Yi.BLL.csproj
@@ -0,0 +1,32 @@
+
+
+
+ netcoreapp3.1
+
+
+
+
+
+
+
+
+
+
+ TextTemplatingFileGenerator
+ T4BLL.cs
+
+
+
+
+
+
+
+
+
+ True
+ True
+ T4BLL.tt
+
+
+
+
diff --git a/CC.Yi.BLL/T4BLL.cs b/CC.Yi.Old/CC.Yi.BLL/T4BLL.cs
similarity index 68%
rename from CC.Yi.BLL/T4BLL.cs
rename to CC.Yi.Old/CC.Yi.BLL/T4BLL.cs
index a74dc943..da68edd2 100644
--- a/CC.Yi.BLL/T4BLL.cs
+++ b/CC.Yi.Old/CC.Yi.BLL/T4BLL.cs
@@ -6,16 +6,14 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
-using Microsoft.EntityFrameworkCore;
namespace CC.Yi.BLL
{
public partial class studentBll : BaseBll, IstudentBll
{
- public studentBll(IBaseDal cd,DataContext _Db):base(cd,_Db)
+ public studentBll(IBaseDal cd):base(cd)
{
CurrentDal = cd;
- DbSession = _Db;
}
}
}
\ No newline at end of file
diff --git a/CC.Yi.Old/CC.Yi.BLL/T4BLL.tt b/CC.Yi.Old/CC.Yi.BLL/T4BLL.tt
new file mode 100644
index 00000000..dcda0135
--- /dev/null
+++ b/CC.Yi.Old/CC.Yi.BLL/T4BLL.tt
@@ -0,0 +1,37 @@
+<#@ template debug="false" hostspecific="true" language="C#" #>
+<#@ assembly name="System.Core" #>
+<#@ import namespace="System.Linq" #>
+<#@ import namespace="System.Text" #>
+<#@ import namespace="System.Collections.Generic" #>
+<#@ import namespace="System.IO" #>
+<#@ output extension=".cs" #>
+<#
+ string solutionsPath = Host.ResolveAssemblyReference("$(SolutionDir)");//获取解决方案路径
+ string txt;
+ StreamReader sr = new StreamReader(solutionsPath+@"\T4Model\T4Model.txt");
+ txt=sr.ReadToEnd();
+ sr.Close();
+ string[] ModelData= txt.Split(',');
+ #>
+
+using CC.Yi.IBLL;
+using CC.Yi.IDAL;
+using CC.Yi.Model;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace CC.Yi.BLL
+{
+<# foreach(string k in ModelData){
+ #>
+ public partial class <#=k #>Bll : BaseBll<<#=k #>>, I<#=k #>Bll
+ {
+ public <#=k #>Bll(IBaseDal<<#=k #>> cd):base(cd)
+ {
+ CurrentDal = cd;
+ }
+ }
+<# } #>
+}
\ No newline at end of file
diff --git a/CC.Yi.Old/CC.Yi.Common/CC.Yi.Common.csproj b/CC.Yi.Old/CC.Yi.Common/CC.Yi.Common.csproj
new file mode 100644
index 00000000..2d1ddc8f
--- /dev/null
+++ b/CC.Yi.Old/CC.Yi.Common/CC.Yi.Common.csproj
@@ -0,0 +1,17 @@
+
+
+
+ netcoreapp3.1
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/CC.Yi.Common/Cache/CacheHelper.cs b/CC.Yi.Old/CC.Yi.Common/Cache/CacheHelper.cs
similarity index 100%
rename from CC.Yi.Common/Cache/CacheHelper.cs
rename to CC.Yi.Old/CC.Yi.Common/Cache/CacheHelper.cs
diff --git a/CC.Yi.Common/Cache/ICacheWriter.cs b/CC.Yi.Old/CC.Yi.Common/Cache/ICacheWriter.cs
similarity index 100%
rename from CC.Yi.Common/Cache/ICacheWriter.cs
rename to CC.Yi.Old/CC.Yi.Common/Cache/ICacheWriter.cs
diff --git a/CC.Yi.Old/CC.Yi.Common/Cache/RedisCache.cs b/CC.Yi.Old/CC.Yi.Common/Cache/RedisCache.cs
new file mode 100644
index 00000000..3e695f02
--- /dev/null
+++ b/CC.Yi.Old/CC.Yi.Common/Cache/RedisCache.cs
@@ -0,0 +1,48 @@
+using ServiceStack.Redis;
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace CC.Yi.Common.Cache
+{
+ public class RedisCache : ICacheWriter
+ {
+ private RedisClient client;
+ public string redisIp { get; set; }
+
+ public RedisCache()
+ {
+ client = new RedisClient("127.0.0.1", 6379, "52013142020.");
+ }
+
+ public bool AddCache(string key, T value, DateTime expDate)
+ {
+ return client.Add(key, value, expDate);
+ }
+
+ public bool AddCache(string key, T value)
+ {
+ return client.Add(key, value);
+ }
+
+ public bool RemoveCache(string key)
+ {
+ return client.Remove(key);
+ }
+
+ public T GetCache(string key)
+ {
+ return client.Get(key);
+ }
+
+ public bool SetCache(string key,T value, DateTime expDate)
+ {
+ return client.Set(key, value, expDate);
+ }
+
+ public bool SetCache(string key, T value)
+ {
+ return client.Set(key, value);
+ }
+ }
+}
diff --git a/CC.Yi.Common/Castle/CustomAutofacAop.cs b/CC.Yi.Old/CC.Yi.Common/Castle/CustomAutofacAop.cs
similarity index 100%
rename from CC.Yi.Common/Castle/CustomAutofacAop.cs
rename to CC.Yi.Old/CC.Yi.Common/Castle/CustomAutofacAop.cs
diff --git a/CC.Yi.Common/HttpHelper.cs b/CC.Yi.Old/CC.Yi.Common/HttpHelper.cs
similarity index 100%
rename from CC.Yi.Common/HttpHelper.cs
rename to CC.Yi.Old/CC.Yi.Common/HttpHelper.cs
diff --git a/CC.Yi.Common/imageHelper.cs b/CC.Yi.Old/CC.Yi.Common/ImageHelper.cs
similarity index 100%
rename from CC.Yi.Common/imageHelper.cs
rename to CC.Yi.Old/CC.Yi.Common/ImageHelper.cs
diff --git a/CC.Yi.Old/CC.Yi.Common/JsonHelper.cs b/CC.Yi.Old/CC.Yi.Common/JsonHelper.cs
new file mode 100644
index 00000000..bf4c8dfa
--- /dev/null
+++ b/CC.Yi.Old/CC.Yi.Common/JsonHelper.cs
@@ -0,0 +1,24 @@
+using System;
+
+namespace CC.Yi.Common
+{
+ public static class JsonHelper
+ {
+ public static string JsonToString(object data=null, int code = 200, bool flag = true, string message = "成功")
+ {
+ return Newtonsoft.Json.JsonConvert.SerializeObject(new { code = code, flag = flag, message = message, data = data });
+ }
+ public static string JsonToString2(object data = null, int code = 200, bool flag = true, string message = "成功",int count=0)
+ {
+ return Newtonsoft.Json.JsonConvert.SerializeObject(new { code = code, flag = flag, message = message, count=count,data = data });
+ }
+ public static string ToString(object data)
+ {
+ return Newtonsoft.Json.JsonConvert.SerializeObject(data);
+ }
+ public static T ToJson(string data)
+ {
+ return Newtonsoft.Json.JsonConvert.DeserializeObject(data);
+ }
+ }
+}
diff --git a/CC.Yi.Common/Jwt/JwtConst.cs b/CC.Yi.Old/CC.Yi.Common/Jwt/JwtConst.cs
similarity index 100%
rename from CC.Yi.Common/Jwt/JwtConst.cs
rename to CC.Yi.Old/CC.Yi.Common/Jwt/JwtConst.cs
diff --git a/CC.Yi.Old/CC.Yi.Common/Result.cs b/CC.Yi.Old/CC.Yi.Common/Result.cs
new file mode 100644
index 00000000..6f210764
--- /dev/null
+++ b/CC.Yi.Old/CC.Yi.Common/Result.cs
@@ -0,0 +1,40 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+
+namespace CC.Yi.Common
+{
+ ///
+ /// 结果数据
+ ///
+ public class Result
+ {
+ public bool status { get; set; }
+ public int code { get; set; }
+ public string msg { get; set; }
+ public object data { get; set; }
+ public static Result Instance(bool status, string msg)
+ {
+ return new Result() { status = status, code = 500, msg = msg };
+ }
+ public static Result Error(string msg = "fail")
+ {
+ return new Result() { status = false, code = 500, msg = msg };
+ }
+ public static Result Success(string msg = "succeed")
+ {
+ return new Result() { status = true, code = 200, msg = msg };
+ }
+ public Result SetData(object obj)
+ {
+ this.data = obj;
+ return this;
+ }
+ public Result SetCode(int Code)
+ {
+ this.code = Code;
+ return this;
+ }
+ }
+}
\ No newline at end of file
diff --git a/CC.Yi.Old/CC.Yi.DAL/BaseDal.cs b/CC.Yi.Old/CC.Yi.DAL/BaseDal.cs
new file mode 100644
index 00000000..4839e885
--- /dev/null
+++ b/CC.Yi.Old/CC.Yi.DAL/BaseDal.cs
@@ -0,0 +1,113 @@
+using CC.Yi.IDAL;
+using CC.Yi.Model;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.ChangeTracking;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Linq.Expressions;
+
+namespace CC.Yi.DAL
+{
+ public class BaseDal : IBaseDal where T : class, new()
+ {
+ public DbContext Db
+ {
+ get { return DbContentFactory.GetCurrentDbContent(); }
+ }
+ public IQueryable GetEntities(Expression> whereLambda)
+ {
+ return Db.Set().Where(whereLambda).AsQueryable();
+ }
+
+ public IQueryable GetAllEntities()
+ {
+ return Db.Set().AsQueryable();
+ }
+
+
+ public int GetCount(Expression> whereLambda)
+ {
+ return Db.Set().Where(whereLambda).Count();
+ }
+
+ public IQueryable> GetGroup(Expression> whereLambda, Expression> groupByLambda) //分组
+ {
+ return Db.Set().Where(whereLambda).GroupBy(groupByLambda).AsQueryable();
+
+ }
+
+
+
+ public IQueryable GetPageEntities(int pageSize, int pageIndex, out int total, Expression> whereLambda, Expression> orderByLambda, bool isAsc)
+ {
+ total = Db.Set().Where(whereLambda).Count();
+ if (isAsc)
+ {
+ var pageData = Db.Set().Where(whereLambda)
+ .OrderBy(orderByLambda)
+ .Skip(pageSize * (pageIndex - 1))
+ .Take(pageSize).AsQueryable();
+ return pageData;
+ }
+ else
+ {
+ var pageData = Db.Set().Where(whereLambda)
+ .OrderByDescending(orderByLambda)
+ .Skip(pageSize * (pageIndex - 1))
+ .Take(pageSize).AsQueryable();
+ return pageData;
+ }
+ }
+
+ public T Add(T entity)
+ {
+ Db.Set().Add(entity);
+ //Db.SaveChanges();
+ return entity;
+ }
+ public bool AddRange(IEnumerable entities)
+ {
+ Db.Set().AddRange(entities);
+ return true;
+ }
+
+ public bool Update(T entity)
+ {
+ //所有字段均修改
+ Db.Entry(entity).State = EntityState.Modified;
+ //return Db.SaveChanges() > 0;
+ return true;
+ }
+ public bool Update(T entity, params string[] propertyNames)
+ {
+ EntityEntry entry = Db.Entry(entity);
+ entry.State = EntityState.Unchanged;
+ foreach (var item in propertyNames)
+ {
+ entry.Property(item).IsModified = true;
+ }
+ return true;
+ }
+
+ public bool Delete(T entity)
+ {
+ Db.Entry(entity).State = EntityState.Deleted;
+ //return Db.SaveChanges() > 0;
+ return true;
+ }
+ public bool Detete(int id)
+ {
+ var entity = Db.Set().Find(id);//根据id找到实体
+ Db.Set().Remove(entity);//由于这里先Find找到了实体,所以这里可以用Remove标记该实体要移除(删除)。如果不是先Find到实体就需要用System.Data.Entity.EntityState.Deleted
+ return true;
+ }
+ public bool DeteteRange(IEnumerable entity)
+ {
+ Db.Set().RemoveRange(entity);
+ return true;
+ }
+
+
+ }
+}
diff --git a/CC.Yi.DAL/CC.Yi.DAL.csproj b/CC.Yi.Old/CC.Yi.DAL/CC.Yi.DAL.csproj
similarity index 100%
rename from CC.Yi.DAL/CC.Yi.DAL.csproj
rename to CC.Yi.Old/CC.Yi.DAL/CC.Yi.DAL.csproj
diff --git a/CC.Yi.Old/CC.Yi.DAL/DbContentFactory.cs b/CC.Yi.Old/CC.Yi.DAL/DbContentFactory.cs
new file mode 100644
index 00000000..73113740
--- /dev/null
+++ b/CC.Yi.Old/CC.Yi.DAL/DbContentFactory.cs
@@ -0,0 +1,58 @@
+using CC.Yi.Model;
+using Microsoft.EntityFrameworkCore;
+using System.Collections.Concurrent;
+using System.Threading;
+
+
+namespace CC.Yi.DAL
+{
+ public class DbContentFactory
+ {
+ private static DataContext Webcontext;
+ private static object myLock = new object();
+
+ public static void Initialize(DataContext webContext)
+ {
+
+ Monitor.Enter(myLock);
+ {
+ Webcontext = webContext;
+ }
+ }
+ public static DataContext GetCurrentDbContent()
+ {
+
+ DataContext db = CallContext.GetData("DbContext") as DataContext;
+
+ if (db == null)//线程在数据槽里面没有此上下文
+ {
+ db = Webcontext;
+ CallContext.SetData("DbContext", db);//放到数据槽中去,DbContext是key,db是value
+ }
+
+ try
+ {
+ Monitor.Exit(myLock);
+ }
+ catch
+ {
+ }
+
+
+ return db;
+
+
+ }
+
+ private static class CallContext
+ {
+ static ConcurrentDictionary> state = new ConcurrentDictionary>();
+
+ public static void SetData(string name, object data) =>
+ state.GetOrAdd(name, _ => new AsyncLocal