完善各层

This commit is contained in:
橙子
2021-10-10 19:10:40 +08:00
parent ee14ab4d2b
commit 23461b15a9
20 changed files with 560 additions and 188 deletions

Binary file not shown.

View File

@@ -5,6 +5,10 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.10">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.6.3" /> <PackageReference Include="Swashbuckle.AspNetCore" Version="5.6.3" />
</ItemGroup> </ItemGroup>

View File

@@ -6,5 +6,8 @@
"Microsoft.Hosting.Lifetime": "Information" "Microsoft.Hosting.Lifetime": "Information"
} }
}, },
"SqliteConn": {
"Url": "Filename=YIDB.db"
},
"AllowedHosts": "*" "AllowedHosts": "*"
} }

View File

@@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Security.Cryptography; using System.Security.Cryptography;
using System.Text; using System.Text;
namespace CC.ElectronicCommerce.Core namespace Yi.Framework.Core
{ {
/// <summary> /// <summary>

View File

@@ -1,5 +1,4 @@
using CC.ElectronicCommerce.Common.IOCOptions; using Microsoft.Extensions.Options;
using Microsoft.Extensions.Options;
using RabbitMQ.Client; using RabbitMQ.Client;
using RabbitMQ.Client.Events; using RabbitMQ.Client.Events;
using System; using System;
@@ -7,6 +6,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using Yi.Framework.Common.IOCOptions;
namespace CC.ElectronicCommerce.Core namespace CC.ElectronicCommerce.Core
{ {

View File

@@ -4,4 +4,35 @@
<TargetFramework>net5.0</TargetFramework> <TargetFramework>net5.0</TargetFramework>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<PackageReference Include="Consul" Version="1.6.10.3" />
<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.Options" Version="5.0.0" />
<PackageReference Include="RabbitMQ.Client" Version="6.2.2" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Yi.Framework.Common\Yi.Framework.Common.csproj" />
</ItemGroup>
<ItemGroup>
<Reference Include="Microsoft.Bcl.AsyncInterfaces">
<HintPath>Library\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
</Reference>
<Reference Include="ServiceStack.Common">
<HintPath>Library\ServiceStack.Common.dll</HintPath>
</Reference>
<Reference Include="ServiceStack.Interfaces">
<HintPath>Library\ServiceStack.Interfaces.dll</HintPath>
</Reference>
<Reference Include="ServiceStack.Redis">
<HintPath>Library\ServiceStack.Redis.dll</HintPath>
</Reference>
<Reference Include="ServiceStack.Text">
<HintPath>Library\ServiceStack.Text.dll</HintPath>
</Reference>
</ItemGroup>
</Project> </Project>

View File

@@ -0,0 +1,77 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Framework.Interface
{
public interface IBaseService<T> where T : class, new()
{
#region
//通过id得到实体
#endregion
Task<T> GetEntityById(int id);
#region
//得到全部实体
#endregion
Task<IEnumerable<T>> GetAllEntitiesAsync();
#region
//通过表达式得到实体
#endregion
Task<IEnumerable<T>> GetEntitiesAsync(Expression<Func<T, bool>> whereLambda);
#region
//通过表达式得到实体,分页版本
#endregion
Task<int> GetCountAsync(Expression<Func<T, bool>> whereLambda);
#region
//通过表达式统计数量
#endregion
IQueryable<IGrouping<S, T>> GetGroup<S>(Expression<Func<T, bool>> whereLambda, Expression<Func<T, S>> groupByLambda);
#region
//通过表达式分组
#endregion
Task<Tuple<IEnumerable<T>, int>> GetPageEntities<S>(int pageSize, int pageIndex, Expression<Func<T, bool>> whereLambda, Expression<Func<T, S>> orderByLambda, bool isAsc);
#region
//添加实体
#endregion
Task<bool> AddAsync(T entity);
#region
//添加多个实体
#endregion
Task<bool> AddAsync(IEnumerable<T> entities);
#region
//更新实体
#endregion
Task<bool> UpdateAsync(T entity);
#region
//更新实体部分属性
#endregion
Task<bool> DeleteAsync(T entity);
#region
//删除实体
#endregion
Task<bool> DeleteAsync(int id);
#region
//通过id删除实体
#endregion
Task<bool> DeleteAsync(IEnumerable<int> ids);
#region
//通过id列表删除多个实体
#endregion
Task<bool> DeleteAsync(Expression<Func<T, bool>> where);
}
}

View File

@@ -6,9 +6,12 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using Yi.Framework.Common.IOCOptions; using Yi.Framework.Common.IOCOptions;
using Yi.Framework.Model.Models;
namespace Yi.Framework.Model.Models namespace Yi.Framework.Model
{ {
//Add-Migration yi-1
//Update-Database yi-1
public class DataContext : DbContext public class DataContext : DbContext
{ {
private readonly IOptionsMonitor<SqliteOptions> _optionsMonitor; private readonly IOptionsMonitor<SqliteOptions> _optionsMonitor;
@@ -31,6 +34,6 @@ namespace Yi.Framework.Model.Models
optionsBuilder.UseSqlite(_connStr); optionsBuilder.UseSqlite(_connStr);
} }
} }
//public virtual DbSet<TbBrand> TbBrand { get; set; } public virtual DbSet<user> user { get; set; }
} }
} }

View File

@@ -0,0 +1,39 @@
// <auto-generated />
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Yi.Framework.Model;
namespace Yi.Framework.Model.Migrations
{
[DbContext(typeof(DataContext))]
[Migration("20211010110842_yi-1")]
partial class yi1
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "5.0.10");
modelBuilder.Entity("Yi.Framework.Model.Models.user", b =>
{
b.Property<int>("id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("age")
.HasColumnType("INTEGER");
b.Property<string>("name")
.HasColumnType("TEXT");
b.HasKey("id");
b.ToTable("user");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,30 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace Yi.Framework.Model.Migrations
{
public partial class yi1 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "user",
columns: table => new
{
id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
name = table.Column<string>(type: "TEXT", nullable: true),
age = table.Column<int>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_user", x => x.id);
});
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "user");
}
}
}

View File

@@ -0,0 +1,37 @@
// <auto-generated />
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Yi.Framework.Model;
namespace Yi.Framework.Model.Migrations
{
[DbContext(typeof(DataContext))]
partial class DataContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "5.0.10");
modelBuilder.Entity("Yi.Framework.Model.Models.user", b =>
{
b.Property<int>("id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("age")
.HasColumnType("INTEGER");
b.Property<string>("name")
.HasColumnType("TEXT");
b.HasKey("id");
b.ToTable("user");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Framework.Model.Models
{
public class user
{
[Key]
public int id { get; set; }
public string name { get; set; }
public int age { get; set; }
}
}

View File

@@ -0,0 +1,119 @@
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
using Yi.Framework.Interface;
namespace Yi.Framework.Service
{
public class CCBaseServer<T> : IBaseService<T> where T : class, new()
{
public DbContext _Db;
public CCBaseServer(DbContext Db)
{
_Db = Db;
}
public async Task<T> GetEntityById(int id)
{
return await _Db.Set<T>().FindAsync(id);
}
public async Task<IEnumerable<T>> GetAllEntitiesAsync()
{
return await _Db.Set<T>().ToListAsync();
}
public async Task<IEnumerable<T>> GetEntitiesAsync(Expression<Func<T, bool>> whereLambda)
{
return await _Db.Set<T>().Where(whereLambda).ToListAsync();
}
public async Task<int> GetCountAsync(Expression<Func<T, bool>> whereLambda) //统计数量
{
return await _Db.Set<T>().CountAsync(whereLambda);
}
public IQueryable<IGrouping<S, T>> GetGroup<S>(Expression<Func<T, bool>> whereLambda, Expression<Func<T, S>> groupByLambda) //分组
{
return _Db.Set<T>().Where(whereLambda).GroupBy(groupByLambda).AsQueryable();
}
public async Task<Tuple<IEnumerable<T>, int>> GetPageEntities<S>(int pageSize, int pageIndex, Expression<Func<T, bool>> whereLambda, Expression<Func<T, S>> orderByLambda, bool isAsc)
{
int total = await GetCountAsync(whereLambda);
IEnumerable<T> pageData;
if (isAsc)
{
pageData = await _Db.Set<T>().Where(whereLambda)
.OrderBy<T, S>(orderByLambda)
.Skip(pageSize * (pageIndex - 1))
.Take(pageSize).ToListAsync();
}
else
{
pageData = await _Db.Set<T>().Where(whereLambda)
.OrderByDescending<T, S>(orderByLambda)
.Skip(pageSize * (pageIndex - 1))
.Take(pageSize).ToListAsync();
}
return Tuple.Create<IEnumerable<T>, int>(pageData, total);
}
public async Task<bool> AddAsync(T entity)
{
_Db.Set<T>().Add(entity);
return await _Db.SaveChangesAsync() > 0;
}
public async Task<bool> AddAsync(IEnumerable<T> entities)
{
_Db.Set<T>().AddRange(entities);
return await _Db.SaveChangesAsync() > 0;
}
public async Task<bool> UpdateAsync(T entity)
{
_Db.Set<T>().Update(entity);
return await _Db.SaveChangesAsync() > 0;
}
public async Task<bool> DeleteAsync(T entity)
{
_Db.Set<T>().Remove(entity);
return await _Db.SaveChangesAsync() > 0;
}
public async Task<bool> DeleteAsync(int id)
{
_Db.Set<T>().Remove(await GetEntityById(id));
return await _Db.SaveChangesAsync() > 0;
}
public async Task<bool> DeleteAsync(IEnumerable<int> ids)
{
foreach (var id in ids)
{
_Db.Set<T>().RemoveRange(await GetEntityById(id));
}
return await _Db.SaveChangesAsync() > 0;
}
public async Task<bool> DeleteAsync(Expression<Func<T, bool>> where)
{
IEnumerable<T> entities = await GetEntitiesAsync(where);
if (entities != null)
{
_Db.Set<T>().RemoveRange(entities);
return await _Db.SaveChangesAsync() > 0;
}
return false;
}
}
}

View File

@@ -4,4 +4,9 @@
<TargetFramework>net5.0</TargetFramework> <TargetFramework>net5.0</TargetFramework>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Yi.Framework.Interface\Yi.Framework.Interface.csproj" />
<ProjectReference Include="..\Yi.Framework.Model\Yi.Framework.Model.csproj" />
</ItemGroup>
</Project> </Project>

View File

@@ -1,36 +1,36 @@
using CC.ElectronicCommerce.Model; //using Yi.Framework.Model;
using Microsoft.AspNetCore.Authentication; //using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Http; //using Microsoft.AspNetCore.Http;
using System; //using System;
using System.Collections.Generic; //using System.Collections.Generic;
using System.Linq; //using System.Linq;
using System.Security.Claims; //using System.Security.Claims;
using System.Text; //using System.Text;
using System.Threading.Tasks; //using System.Threading.Tasks;
namespace CC.ElectronicCommerce.WebCore //namespace CC.ElectronicCommerce.WebCore
{ //{
public static class CommonExtend // public static class CommonExtend
{ // {
public static bool IsAjaxRequest(this HttpRequest request) // public static bool IsAjaxRequest(this HttpRequest request)
{ // {
string header = request.Headers["X-Requested-With"]; // string header = request.Headers["X-Requested-With"];
return "XMLHttpRequest".Equals(header); // return "XMLHttpRequest".Equals(header);
} // }
/// <summary> // /// <summary>
/// 基于HttpContext,当前鉴权方式解析,获取用户信息 // /// 基于HttpContext,当前鉴权方式解析,获取用户信息
/// </summary> // /// </summary>
/// <param name="httpContext"></param> // /// <param name="httpContext"></param>
/// <returns></returns> // /// <returns></returns>
public static UserInfo GetCurrentUserInfo(this HttpContext httpContext) // public static UserInfo GetCurrentUserInfo(this HttpContext httpContext)
{ // {
IEnumerable<Claim> claimlist = httpContext.AuthenticateAsync().Result.Principal.Claims; // IEnumerable<Claim> claimlist = httpContext.AuthenticateAsync().Result.Principal.Claims;
return new UserInfo() // return new UserInfo()
{ // {
id = long.Parse(claimlist.FirstOrDefault(u => u.Type == "id").Value), // id = long.Parse(claimlist.FirstOrDefault(u => u.Type == "id").Value),
username = claimlist.FirstOrDefault(u => u.Type == "username").Value ?? "匿名" // username = claimlist.FirstOrDefault(u => u.Type == "username").Value ?? "匿名"
}; // };
} // }
} // }
} //}

View File

@@ -1,5 +1,5 @@
using CC.ElectronicCommerce.Common.Models; using Yi.Framework.Common.Models;
using CC.ElectronicCommerce.Core; using Yi.Framework.Core;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters; using Microsoft.AspNetCore.Mvc.Filters;

View File

@@ -6,7 +6,7 @@ using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Newtonsoft.Json; using Newtonsoft.Json;
using CC.ElectronicCommerce.Common.Models; using Yi.Framework.Common.Models;
namespace CC.ElectronicCommerce.WebCore.FilterExtend namespace CC.ElectronicCommerce.WebCore.FilterExtend
{ {

View File

@@ -1,4 +1,4 @@
using CC.ElectronicCommerce.Common.Models; using Yi.Framework.Common.Models;
using Microsoft.AspNetCore.Mvc.Filters; using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Newtonsoft.Json; using Newtonsoft.Json;

View File

@@ -1,156 +1,156 @@
using Microsoft.AspNetCore.Builder; //using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http; //using Microsoft.AspNetCore.Http;
using System; //using System;
using System.Collections.Generic; //using System.Collections.Generic;
using System.IO; //using System.IO;
using System.Linq; //using System.Linq;
using System.Text; //using System.Text;
using System.Threading.Tasks; //using System.Threading.Tasks;
namespace CC.ElectronicCommerce.WebCore.MiddlewareExtend //namespace CC.ElectronicCommerce.WebCore.MiddlewareExtend
{ //{
/// <summary> // /// <summary>
/// 支持在返回HTML时将返回的Stream保存到指定目录 // /// 支持在返回HTML时将返回的Stream保存到指定目录
/// </summary> // /// </summary>
public class StaticPageMiddleware // public class StaticPageMiddleware
{ // {
private readonly RequestDelegate _next; // private readonly RequestDelegate _next;
private string _directoryPath = @"D:/cc-ec/"; // private string _directoryPath = @"D:/cc-ec/";
private bool _supportDelete = false; // private bool _supportDelete = false;
private bool _supportWarmup = false; // private bool _supportWarmup = false;
public StaticPageMiddleware(RequestDelegate next, string directoryPath, bool supportDelete, bool supportWarmup) // public StaticPageMiddleware(RequestDelegate next, string directoryPath, bool supportDelete, bool supportWarmup)
{ // {
this._next = next; // this._next = next;
this._directoryPath = directoryPath; // this._directoryPath = directoryPath;
this._supportDelete = supportDelete; // this._supportDelete = supportDelete;
this._supportWarmup = supportWarmup; // this._supportWarmup = supportWarmup;
} // }
public async Task InvokeAsync(HttpContext context) // public async Task InvokeAsync(HttpContext context)
{ // {
if (this._supportDelete && "Delete".Equals(context.Request.Query["ActionHeader"])) // if (this._supportDelete && "Delete".Equals(context.Request.Query["ActionHeader"]))
{ // {
this.DeleteHmtl(context.Request.Path.Value); // this.DeleteHmtl(context.Request.Path.Value);
context.Response.StatusCode = 200; // context.Response.StatusCode = 200;
} // }
else if (this._supportWarmup && "ClearAll".Equals(context.Request.Query["ActionHeader"])) // else if (this._supportWarmup && "ClearAll".Equals(context.Request.Query["ActionHeader"]))
{ // {
this.ClearDirectory(10);//考虑数据量 // this.ClearDirectory(10);//考虑数据量
context.Response.StatusCode = 200; // context.Response.StatusCode = 200;
} // }
else if (!context.Request.IsAjaxRequest()) // else if (!context.Request.IsAjaxRequest())
{ // {
Console.WriteLine($"This is StaticPageMiddleware InvokeAsync {context.Request.Path.Value}"); // Console.WriteLine($"This is StaticPageMiddleware InvokeAsync {context.Request.Path.Value}");
#region context.Response.Body // #region context.Response.Body
var originalStream = context.Response.Body; // var originalStream = context.Response.Body;
using (var copyStream = new MemoryStream()) // using (var copyStream = new MemoryStream())
{ // {
context.Response.Body = copyStream; // context.Response.Body = copyStream;
await _next(context); // await _next(context);
copyStream.Position = 0; // copyStream.Position = 0;
var reader = new StreamReader(copyStream); // var reader = new StreamReader(copyStream);
var content = await reader.ReadToEndAsync(); // var content = await reader.ReadToEndAsync();
string url = context.Request.Path.Value; // string url = context.Request.Path.Value;
this.SaveHmtl(url, content); // this.SaveHmtl(url, content);
copyStream.Position = 0; // copyStream.Position = 0;
await copyStream.CopyToAsync(originalStream); // await copyStream.CopyToAsync(originalStream);
context.Response.Body = originalStream; // context.Response.Body = originalStream;
} // }
#endregion // #endregion
} // }
else // else
{ // {
await _next(context); // await _next(context);
} // }
} // }
private void SaveHmtl(string url, string html) // private void SaveHmtl(string url, string html)
{ // {
try // try
{ // {
//Console.WriteLine($"Response: {html}"); // //Console.WriteLine($"Response: {html}");
if (string.IsNullOrWhiteSpace(html)) // if (string.IsNullOrWhiteSpace(html))
return; // return;
if (!url.EndsWith(".html")) // if (!url.EndsWith(".html"))
return; // return;
if (Directory.Exists(_directoryPath) == false) // if (Directory.Exists(_directoryPath) == false)
Directory.CreateDirectory(_directoryPath); // Directory.CreateDirectory(_directoryPath);
var totalPath = Path.Combine(_directoryPath, url.Split("/").Last()); // var totalPath = Path.Combine(_directoryPath, url.Split("/").Last());
File.WriteAllText(totalPath, html);//直接覆盖 // File.WriteAllText(totalPath, html);//直接覆盖
} // }
catch (Exception ex) // catch (Exception ex)
{ // {
Console.WriteLine(ex.Message); // Console.WriteLine(ex.Message);
} // }
} // }
/// <summary> // /// <summary>
/// 删除某个页面 // /// 删除某个页面
/// </summary> // /// </summary>
/// <param name="url"></param> // /// <param name="url"></param>
/// <param name="index"></param> // /// <param name="index"></param>
private void DeleteHmtl(string url) // private void DeleteHmtl(string url)
{ // {
try // try
{ // {
if (!url.EndsWith(".html")) // if (!url.EndsWith(".html"))
return; // return;
var totalPath = Path.Combine(_directoryPath, url.Split("/").Last()); // var totalPath = Path.Combine(_directoryPath, url.Split("/").Last());
File.Delete(totalPath);//直接删除 // File.Delete(totalPath);//直接删除
} // }
catch (Exception ex) // catch (Exception ex)
{ // {
Console.WriteLine($"Delete {url} 异常,{ex.Message}"); // Console.WriteLine($"Delete {url} 异常,{ex.Message}");
} // }
} // }
/// <summary> // /// <summary>
/// 清理文件,支持重试 // /// 清理文件,支持重试
/// </summary> // /// </summary>
/// <param name="index">最多重试次数</param> // /// <param name="index">最多重试次数</param>
private void ClearDirectory(int index) // private void ClearDirectory(int index)
{ // {
if (index > 0)//简陋版---重试index次 // if (index > 0)//简陋版---重试index次
{ // {
try // try
{ // {
var files = Directory.GetFiles(_directoryPath); // var files = Directory.GetFiles(_directoryPath);
foreach (var file in files) // foreach (var file in files)
{ // {
File.Delete(file); // File.Delete(file);
} // }
} // }
catch (Exception ex) // catch (Exception ex)
{ // {
Console.WriteLine($"ClearDirectory failed {ex.Message}"); // Console.WriteLine($"ClearDirectory failed {ex.Message}");
ClearDirectory(index--); // ClearDirectory(index--);
} // }
} // }
} // }
} // }
/// <summary> // /// <summary>
/// 扩展中间件 // /// 扩展中间件
/// </summary> // /// </summary>
public static class StaticPageMiddlewareExtensions // public static class StaticPageMiddlewareExtensions
{ // {
/// <summary> // /// <summary>
/// // ///
/// </summary> // /// </summary>
/// <param name="app"></param> // /// <param name="app"></param>
/// <param name="directoryPath">文件写入地址,文件夹目录</param> // /// <param name="directoryPath">文件写入地址,文件夹目录</param>
/// <param name="supportDelete">是否支持删除</param> // /// <param name="supportDelete">是否支持删除</param>
/// <param name="supportClear">是否支持全量删除</param> // /// <param name="supportClear">是否支持全量删除</param>
/// <returns></returns> // /// <returns></returns>
public static IApplicationBuilder UseStaticPageMiddleware(this IApplicationBuilder app, string directoryPath, bool supportDelete, bool supportClear) // public static IApplicationBuilder UseStaticPageMiddleware(this IApplicationBuilder app, string directoryPath, bool supportDelete, bool supportClear)
{ // {
return app.UseMiddleware<StaticPageMiddleware>(directoryPath, supportDelete, supportClear); // return app.UseMiddleware<StaticPageMiddleware>(directoryPath, supportDelete, supportClear);
} // }
} // }
} //}

View File

@@ -5,7 +5,14 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Authentication.Abstractions" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.2.0" /> <PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Abstractions" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Formatters.Json" Version="2.2.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Yi.Framework.Core\Yi.Framework.Core.csproj" />
</ItemGroup> </ItemGroup>
</Project> </Project>