优化扩展
This commit is contained in:
@@ -18,6 +18,7 @@ using Yi.Framework.Common.IOCOptions;
|
|||||||
using Yi.Framework.Interface;
|
using Yi.Framework.Interface;
|
||||||
using Yi.Framework.Model;
|
using Yi.Framework.Model;
|
||||||
using Yi.Framework.Service;
|
using Yi.Framework.Service;
|
||||||
|
using Yi.Framework.WebCore;
|
||||||
using Yi.Framework.WebCore.MiddlewareExtend;
|
using Yi.Framework.WebCore.MiddlewareExtend;
|
||||||
|
|
||||||
namespace Yi.Framework.ApiMicroservice
|
namespace Yi.Framework.ApiMicroservice
|
||||||
@@ -34,6 +35,11 @@ namespace Yi.Framework.ApiMicroservice
|
|||||||
// This method gets called by the runtime. Use this method to add services to the container.
|
// This method gets called by the runtime. Use this method to add services to the container.
|
||||||
public void ConfigureServices(IServiceCollection services)
|
public void ConfigureServices(IServiceCollection services)
|
||||||
{
|
{
|
||||||
|
#region
|
||||||
|
//Ioc<6F><63><EFBFBD><EFBFBD>
|
||||||
|
#endregion
|
||||||
|
services.AddIocService(Configuration);
|
||||||
|
|
||||||
#region
|
#region
|
||||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>+<2B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>+<2B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
#endregion
|
#endregion
|
||||||
@@ -50,25 +56,21 @@ namespace Yi.Framework.ApiMicroservice
|
|||||||
services.AddCorsService();
|
services.AddCorsService();
|
||||||
|
|
||||||
#region
|
#region
|
||||||
//<EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
//Sqlite<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
#endregion
|
#endregion
|
||||||
services.AddDataBaseService<SqliteOptions>("SqliteConn");
|
services.AddSqliteService();
|
||||||
|
|
||||||
#region
|
#region
|
||||||
//Redis<69><73><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
//Redis<69><73><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
#endregion
|
#endregion
|
||||||
services.AddRedisService();
|
//services.AddRedisService();
|
||||||
|
|
||||||
#region
|
#region
|
||||||
//RabbitMQ<4D><51><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
//RabbitMQ<4D><51><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
#endregion
|
#endregion
|
||||||
services.AddRabbitMQService();
|
//services.AddRabbitMQService();
|
||||||
|
|
||||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ЩӦ<D0A9>Զ<EFBFBD>ע<EFBFBD><D7A2>
|
|
||||||
services.AddScoped<IUserService, UserService>();
|
|
||||||
services.AddScoped<IRoleService, RoleService>();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Autofac<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ע<EFBFBD><EFBFBD>
|
#region Autofac<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ע<EFBFBD><EFBFBD>
|
||||||
@@ -82,7 +84,7 @@ namespace Yi.Framework.ApiMicroservice
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
||||||
public async void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
||||||
{
|
{
|
||||||
//if (env.IsDevelopment())
|
//if (env.IsDevelopment())
|
||||||
{
|
{
|
||||||
@@ -115,7 +117,7 @@ namespace Yi.Framework.ApiMicroservice
|
|||||||
#region
|
#region
|
||||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ע<EFBFBD><D7A2>
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ע<EFBFBD><D7A2>
|
||||||
#endregion
|
#endregion
|
||||||
app.UseHealthCheckMiddleware();
|
//app.UseHealthCheckMiddleware();
|
||||||
|
|
||||||
#region
|
#region
|
||||||
//<2F><>Ȩע<C8A8><D7A2>
|
//<2F><>Ȩע<C8A8><D7A2>
|
||||||
@@ -130,7 +132,7 @@ namespace Yi.Framework.ApiMicroservice
|
|||||||
#region
|
#region
|
||||||
//Consul<75><6C><EFBFBD><EFBFBD>ע<EFBFBD><D7A2>
|
//Consul<75><6C><EFBFBD><EFBFBD>ע<EFBFBD><D7A2>
|
||||||
#endregion
|
#endregion
|
||||||
await app.UseConsulService();
|
//await app.UseConsulService();
|
||||||
|
|
||||||
#region
|
#region
|
||||||
//Endpointsע<73><D7A2>
|
//Endpointsע<73><D7A2>
|
||||||
|
|||||||
43
Yi.Framework/Yi.Framework.ApiMicroservice/SwaggerDoc.xml
Normal file
43
Yi.Framework/Yi.Framework.ApiMicroservice/SwaggerDoc.xml
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<doc>
|
||||||
|
<assembly>
|
||||||
|
<name>Yi.Framework.ApiMicroservice</name>
|
||||||
|
</assembly>
|
||||||
|
<members>
|
||||||
|
<member name="M:Yi.Framework.ApiMicroservice.Controllers.UserController.GetUser">
|
||||||
|
<summary>
|
||||||
|
查
|
||||||
|
</summary>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:Yi.Framework.ApiMicroservice.Controllers.UserController.UpdateUser(Yi.Framework.Model.Models.user)">
|
||||||
|
<summary>
|
||||||
|
更
|
||||||
|
</summary>
|
||||||
|
<param name="_user"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:Yi.Framework.ApiMicroservice.Controllers.UserController.DelListUser(System.Collections.Generic.List{System.Int32})">
|
||||||
|
<summary>
|
||||||
|
删
|
||||||
|
</summary>
|
||||||
|
<param name="_ids"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:Yi.Framework.ApiMicroservice.Controllers.UserController.AddUser(Yi.Framework.Model.Models.user)">
|
||||||
|
<summary>
|
||||||
|
增
|
||||||
|
</summary>
|
||||||
|
<param name="_user"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="T:Yi.Framework.ApiMicroservice.Utility.CustomHostingStartup">
|
||||||
|
<summary>
|
||||||
|
必须实现IHostingStartup接口
|
||||||
|
必须标记HostingStartup特性
|
||||||
|
|
||||||
|
就像木马一样
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
</members>
|
||||||
|
</doc>
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
using System;
|
using Castle.DynamicProxy;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|||||||
@@ -39,9 +39,12 @@ namespace Yi.Framework.ApiMicroservice.Utility
|
|||||||
//containerBuilder.RegisterType<A>().As<IA>().EnableInterfaceInterceptors();开启Aop
|
//containerBuilder.RegisterType<A>().As<IA>().EnableInterfaceInterceptors();开启Aop
|
||||||
|
|
||||||
//将数据库对象注入
|
//将数据库对象注入
|
||||||
containerBuilder.RegisterType<DataContext>().As<DbContext>().InstancePerLifetimeScope().EnableInterfaceInterceptors();
|
//containerBuilder.RegisterType<DataContext>().As<DbContext>().InstancePerLifetimeScope().EnableInterfaceInterceptors();
|
||||||
|
|
||||||
containerBuilder.RegisterGeneric(typeof(BaseService<>)).As(typeof(IBaseService<>)).EnableInterfaceInterceptors();
|
containerBuilder.RegisterGeneric(typeof(BaseService<>)).As(typeof(IBaseService<>)).InstancePerLifetimeScope().EnableInterfaceInterceptors();
|
||||||
|
|
||||||
|
containerBuilder.RegisterType<UserService>().As< IUserService >().InstancePerLifetimeScope().EnableInterfaceInterceptors();
|
||||||
|
containerBuilder.RegisterType<RoleService>().As<IRoleService>().InstancePerLifetimeScope().EnableInterfaceInterceptors();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
@@ -5,11 +5,14 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||||
<DocumentationFile>D:\CC.Yi\CC.Yi\Yi.Framework\Yi.Framework.ApiMicroservice\Yi.Framework.ApiMicroservice.xml</DocumentationFile>
|
<DocumentationFile>D:\CC.Yi\CC.Yi\Yi.Framework\Yi.Framework.ApiMicroservice\SwaggerDoc.xml</DocumentationFile>
|
||||||
<NoWarn>1701;1702;CS1591</NoWarn>
|
<NoWarn>1701;1702;CS1591</NoWarn>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Autofac" Version="6.3.0" />
|
||||||
|
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="7.1.0" />
|
||||||
|
<PackageReference Include="Autofac.Extras.DynamicProxy" Version="6.0.0" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.10">
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.10">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
@@ -21,6 +24,7 @@
|
|||||||
<ProjectReference Include="..\Yi.Framework.Interface\Yi.Framework.Interface.csproj" />
|
<ProjectReference Include="..\Yi.Framework.Interface\Yi.Framework.Interface.csproj" />
|
||||||
<ProjectReference Include="..\Yi.Framework.Model\Yi.Framework.Model.csproj" />
|
<ProjectReference Include="..\Yi.Framework.Model\Yi.Framework.Model.csproj" />
|
||||||
<ProjectReference Include="..\Yi.Framework.Service\Yi.Framework.Service.csproj" />
|
<ProjectReference Include="..\Yi.Framework.Service\Yi.Framework.Service.csproj" />
|
||||||
|
<ProjectReference Include="..\Yi.Framework.WebCore\Yi.Framework.WebCore.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -5,6 +5,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 Yi.Framework.Core.ConsulExtend
|
namespace Yi.Framework.Core.ConsulExtend
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -4,8 +4,9 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using Consul;
|
using Consul;
|
||||||
using Microsoft.Extensions.Options;
|
using Microsoft.Extensions.Options;
|
||||||
|
using Yi.Framework.Common.IOCOptions;
|
||||||
|
|
||||||
namespace CC.ElectronicCommerce.Core.ConsulExtend
|
namespace Yi.Framework.Core.ConsulExtend
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 轮询
|
/// 轮询
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using Consul;
|
using Consul;
|
||||||
using Microsoft.Extensions.Options;
|
using Microsoft.Extensions.Options;
|
||||||
|
using Yi.Framework.Common.IOCOptions;
|
||||||
|
|
||||||
namespace Yi.Framework.Core.ConsulExtend
|
namespace Yi.Framework.Core.ConsulExtend
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,39 +0,0 @@
|
|||||||
// <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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
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");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,78 +0,0 @@
|
|||||||
// <auto-generated />
|
|
||||||
using System;
|
|
||||||
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("20211011082334_yi-2")]
|
|
||||||
partial class yi2
|
|
||||||
{
|
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
|
||||||
{
|
|
||||||
#pragma warning disable 612, 618
|
|
||||||
modelBuilder
|
|
||||||
.HasAnnotation("ProductVersion", "5.0.10");
|
|
||||||
|
|
||||||
modelBuilder.Entity("Yi.Framework.Model.Models.role", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("INTEGER");
|
|
||||||
|
|
||||||
b.Property<string>("introduce")
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.Property<int>("is_delete")
|
|
||||||
.HasColumnType("INTEGER");
|
|
||||||
|
|
||||||
b.Property<string>("role_name")
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.HasKey("id");
|
|
||||||
|
|
||||||
b.ToTable("role");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Yi.Framework.Model.Models.user", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("INTEGER");
|
|
||||||
|
|
||||||
b.Property<int?>("age")
|
|
||||||
.HasColumnType("INTEGER");
|
|
||||||
|
|
||||||
b.Property<string>("email")
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.Property<string>("icon")
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.Property<string>("ip")
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.Property<int>("is_delete")
|
|
||||||
.HasColumnType("INTEGER");
|
|
||||||
|
|
||||||
b.Property<string>("nick")
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.Property<string>("password")
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.Property<string>("username")
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.HasKey("id");
|
|
||||||
|
|
||||||
b.ToTable("user");
|
|
||||||
});
|
|
||||||
#pragma warning restore 612, 618
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,120 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
|
|
||||||
namespace Yi.Framework.Model.Migrations
|
|
||||||
{
|
|
||||||
public partial class yi2 : Migration
|
|
||||||
{
|
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.RenameColumn(
|
|
||||||
name: "name",
|
|
||||||
table: "user",
|
|
||||||
newName: "username");
|
|
||||||
|
|
||||||
migrationBuilder.AlterColumn<int>(
|
|
||||||
name: "age",
|
|
||||||
table: "user",
|
|
||||||
type: "INTEGER",
|
|
||||||
nullable: true,
|
|
||||||
oldClrType: typeof(int),
|
|
||||||
oldType: "INTEGER");
|
|
||||||
|
|
||||||
migrationBuilder.AddColumn<string>(
|
|
||||||
name: "email",
|
|
||||||
table: "user",
|
|
||||||
type: "TEXT",
|
|
||||||
nullable: true);
|
|
||||||
|
|
||||||
migrationBuilder.AddColumn<string>(
|
|
||||||
name: "icon",
|
|
||||||
table: "user",
|
|
||||||
type: "TEXT",
|
|
||||||
nullable: true);
|
|
||||||
|
|
||||||
migrationBuilder.AddColumn<string>(
|
|
||||||
name: "ip",
|
|
||||||
table: "user",
|
|
||||||
type: "TEXT",
|
|
||||||
nullable: true);
|
|
||||||
|
|
||||||
migrationBuilder.AddColumn<int>(
|
|
||||||
name: "is_delete",
|
|
||||||
table: "user",
|
|
||||||
type: "INTEGER",
|
|
||||||
nullable: false,
|
|
||||||
defaultValue: 0);
|
|
||||||
|
|
||||||
migrationBuilder.AddColumn<string>(
|
|
||||||
name: "nick",
|
|
||||||
table: "user",
|
|
||||||
type: "TEXT",
|
|
||||||
nullable: true);
|
|
||||||
|
|
||||||
migrationBuilder.AddColumn<string>(
|
|
||||||
name: "password",
|
|
||||||
table: "user",
|
|
||||||
type: "TEXT",
|
|
||||||
nullable: true);
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "role",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
id = table.Column<int>(type: "INTEGER", nullable: false)
|
|
||||||
.Annotation("Sqlite:Autoincrement", true),
|
|
||||||
role_name = table.Column<string>(type: "TEXT", nullable: true),
|
|
||||||
introduce = table.Column<string>(type: "TEXT", nullable: true),
|
|
||||||
is_delete = table.Column<int>(type: "INTEGER", nullable: false)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_role", x => x.id);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "role");
|
|
||||||
|
|
||||||
migrationBuilder.DropColumn(
|
|
||||||
name: "email",
|
|
||||||
table: "user");
|
|
||||||
|
|
||||||
migrationBuilder.DropColumn(
|
|
||||||
name: "icon",
|
|
||||||
table: "user");
|
|
||||||
|
|
||||||
migrationBuilder.DropColumn(
|
|
||||||
name: "ip",
|
|
||||||
table: "user");
|
|
||||||
|
|
||||||
migrationBuilder.DropColumn(
|
|
||||||
name: "is_delete",
|
|
||||||
table: "user");
|
|
||||||
|
|
||||||
migrationBuilder.DropColumn(
|
|
||||||
name: "nick",
|
|
||||||
table: "user");
|
|
||||||
|
|
||||||
migrationBuilder.DropColumn(
|
|
||||||
name: "password",
|
|
||||||
table: "user");
|
|
||||||
|
|
||||||
migrationBuilder.RenameColumn(
|
|
||||||
name: "username",
|
|
||||||
table: "user",
|
|
||||||
newName: "name");
|
|
||||||
|
|
||||||
migrationBuilder.AlterColumn<int>(
|
|
||||||
name: "age",
|
|
||||||
table: "user",
|
|
||||||
type: "INTEGER",
|
|
||||||
nullable: false,
|
|
||||||
defaultValue: 0,
|
|
||||||
oldClrType: typeof(int),
|
|
||||||
oldType: "INTEGER",
|
|
||||||
oldNullable: true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
218
Yi.Framework/Yi.Framework.Model/Migrations/20211013073148_yi-1.Designer.cs
generated
Normal file
218
Yi.Framework/Yi.Framework.Model/Migrations/20211013073148_yi-1.Designer.cs
generated
Normal file
@@ -0,0 +1,218 @@
|
|||||||
|
// <auto-generated />
|
||||||
|
using System;
|
||||||
|
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("20211013073148_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.menu", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("icon")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int>("is_delete")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int?>("is_top")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("menu_name")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int?>("menuid")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int?>("mouldid")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("router")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int?>("sort")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.HasKey("id");
|
||||||
|
|
||||||
|
b.HasIndex("menuid");
|
||||||
|
|
||||||
|
b.HasIndex("mouldid");
|
||||||
|
|
||||||
|
b.ToTable("menu");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Yi.Framework.Model.Models.mould", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int>("is_delete")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("mould_name")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("url")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("id");
|
||||||
|
|
||||||
|
b.ToTable("mould");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Yi.Framework.Model.Models.role", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("introduce")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int>("is_delete")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("role_name")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("id");
|
||||||
|
|
||||||
|
b.ToTable("role");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Yi.Framework.Model.Models.user", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int?>("age")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("email")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("icon")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("introduction")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("ip")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int>("is_delete")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("nick")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("password")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("username")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("id");
|
||||||
|
|
||||||
|
b.ToTable("user");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("menurole", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("menusid")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int>("rolesid")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.HasKey("menusid", "rolesid");
|
||||||
|
|
||||||
|
b.HasIndex("rolesid");
|
||||||
|
|
||||||
|
b.ToTable("menurole");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("roleuser", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("rolesid")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int>("usersid")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.HasKey("rolesid", "usersid");
|
||||||
|
|
||||||
|
b.HasIndex("usersid");
|
||||||
|
|
||||||
|
b.ToTable("roleuser");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Yi.Framework.Model.Models.menu", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Yi.Framework.Model.Models.menu", null)
|
||||||
|
.WithMany("children")
|
||||||
|
.HasForeignKey("menuid");
|
||||||
|
|
||||||
|
b.HasOne("Yi.Framework.Model.Models.mould", "mould")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("mouldid");
|
||||||
|
|
||||||
|
b.Navigation("mould");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("menurole", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Yi.Framework.Model.Models.menu", null)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("menusid")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("Yi.Framework.Model.Models.role", null)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("rolesid")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("roleuser", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Yi.Framework.Model.Models.role", null)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("rolesid")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("Yi.Framework.Model.Models.user", null)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("usersid")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Yi.Framework.Model.Models.menu", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("children");
|
||||||
|
});
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,182 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
namespace Yi.Framework.Model.Migrations
|
||||||
|
{
|
||||||
|
public partial class yi1 : Migration
|
||||||
|
{
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "mould",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
id = table.Column<int>(type: "INTEGER", nullable: false)
|
||||||
|
.Annotation("Sqlite:Autoincrement", true),
|
||||||
|
mould_name = table.Column<string>(type: "TEXT", nullable: true),
|
||||||
|
url = table.Column<string>(type: "TEXT", nullable: true),
|
||||||
|
is_delete = table.Column<int>(type: "INTEGER", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_mould", x => x.id);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "role",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
id = table.Column<int>(type: "INTEGER", nullable: false)
|
||||||
|
.Annotation("Sqlite:Autoincrement", true),
|
||||||
|
role_name = table.Column<string>(type: "TEXT", nullable: true),
|
||||||
|
introduce = table.Column<string>(type: "TEXT", nullable: true),
|
||||||
|
is_delete = table.Column<int>(type: "INTEGER", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_role", x => x.id);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "user",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
id = table.Column<int>(type: "INTEGER", nullable: false)
|
||||||
|
.Annotation("Sqlite:Autoincrement", true),
|
||||||
|
username = table.Column<string>(type: "TEXT", nullable: true),
|
||||||
|
password = table.Column<string>(type: "TEXT", nullable: true),
|
||||||
|
icon = table.Column<string>(type: "TEXT", nullable: true),
|
||||||
|
nick = table.Column<string>(type: "TEXT", nullable: true),
|
||||||
|
email = table.Column<string>(type: "TEXT", nullable: true),
|
||||||
|
ip = table.Column<string>(type: "TEXT", nullable: true),
|
||||||
|
age = table.Column<int>(type: "INTEGER", nullable: true),
|
||||||
|
introduction = table.Column<string>(type: "TEXT", nullable: true),
|
||||||
|
is_delete = table.Column<int>(type: "INTEGER", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_user", x => x.id);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "menu",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
id = table.Column<int>(type: "INTEGER", nullable: false)
|
||||||
|
.Annotation("Sqlite:Autoincrement", true),
|
||||||
|
icon = table.Column<string>(type: "TEXT", nullable: true),
|
||||||
|
router = table.Column<string>(type: "TEXT", nullable: true),
|
||||||
|
menu_name = table.Column<string>(type: "TEXT", nullable: true),
|
||||||
|
mouldid = table.Column<int>(type: "INTEGER", nullable: true),
|
||||||
|
menuid = table.Column<int>(type: "INTEGER", nullable: true),
|
||||||
|
is_delete = table.Column<int>(type: "INTEGER", nullable: false),
|
||||||
|
is_top = table.Column<int>(type: "INTEGER", nullable: true),
|
||||||
|
sort = table.Column<int>(type: "INTEGER", nullable: true)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_menu", x => x.id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_menu_menu_menuid",
|
||||||
|
column: x => x.menuid,
|
||||||
|
principalTable: "menu",
|
||||||
|
principalColumn: "id",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_menu_mould_mouldid",
|
||||||
|
column: x => x.mouldid,
|
||||||
|
principalTable: "mould",
|
||||||
|
principalColumn: "id",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "roleuser",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
rolesid = table.Column<int>(type: "INTEGER", nullable: false),
|
||||||
|
usersid = table.Column<int>(type: "INTEGER", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_roleuser", x => new { x.rolesid, x.usersid });
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_roleuser_role_rolesid",
|
||||||
|
column: x => x.rolesid,
|
||||||
|
principalTable: "role",
|
||||||
|
principalColumn: "id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_roleuser_user_usersid",
|
||||||
|
column: x => x.usersid,
|
||||||
|
principalTable: "user",
|
||||||
|
principalColumn: "id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "menurole",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
menusid = table.Column<int>(type: "INTEGER", nullable: false),
|
||||||
|
rolesid = table.Column<int>(type: "INTEGER", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_menurole", x => new { x.menusid, x.rolesid });
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_menurole_menu_menusid",
|
||||||
|
column: x => x.menusid,
|
||||||
|
principalTable: "menu",
|
||||||
|
principalColumn: "id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_menurole_role_rolesid",
|
||||||
|
column: x => x.rolesid,
|
||||||
|
principalTable: "role",
|
||||||
|
principalColumn: "id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_menu_menuid",
|
||||||
|
table: "menu",
|
||||||
|
column: "menuid");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_menu_mouldid",
|
||||||
|
table: "menu",
|
||||||
|
column: "mouldid");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_menurole_rolesid",
|
||||||
|
table: "menurole",
|
||||||
|
column: "rolesid");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_roleuser_usersid",
|
||||||
|
table: "roleuser",
|
||||||
|
column: "usersid");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "menurole");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "roleuser");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "menu");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "role");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "user");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "mould");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -16,6 +16,65 @@ namespace Yi.Framework.Model.Migrations
|
|||||||
modelBuilder
|
modelBuilder
|
||||||
.HasAnnotation("ProductVersion", "5.0.10");
|
.HasAnnotation("ProductVersion", "5.0.10");
|
||||||
|
|
||||||
|
modelBuilder.Entity("Yi.Framework.Model.Models.menu", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("icon")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int>("is_delete")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int?>("is_top")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("menu_name")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int?>("menuid")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int?>("mouldid")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("router")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int?>("sort")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.HasKey("id");
|
||||||
|
|
||||||
|
b.HasIndex("menuid");
|
||||||
|
|
||||||
|
b.HasIndex("mouldid");
|
||||||
|
|
||||||
|
b.ToTable("menu");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Yi.Framework.Model.Models.mould", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int>("is_delete")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("mould_name")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("url")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("id");
|
||||||
|
|
||||||
|
b.ToTable("mould");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Yi.Framework.Model.Models.role", b =>
|
modelBuilder.Entity("Yi.Framework.Model.Models.role", b =>
|
||||||
{
|
{
|
||||||
b.Property<int>("id")
|
b.Property<int>("id")
|
||||||
@@ -51,6 +110,9 @@ namespace Yi.Framework.Model.Migrations
|
|||||||
b.Property<string>("icon")
|
b.Property<string>("icon")
|
||||||
.HasColumnType("TEXT");
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("introduction")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
b.Property<string>("ip")
|
b.Property<string>("ip")
|
||||||
.HasColumnType("TEXT");
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
@@ -70,6 +132,84 @@ namespace Yi.Framework.Model.Migrations
|
|||||||
|
|
||||||
b.ToTable("user");
|
b.ToTable("user");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("menurole", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("menusid")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int>("rolesid")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.HasKey("menusid", "rolesid");
|
||||||
|
|
||||||
|
b.HasIndex("rolesid");
|
||||||
|
|
||||||
|
b.ToTable("menurole");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("roleuser", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("rolesid")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int>("usersid")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.HasKey("rolesid", "usersid");
|
||||||
|
|
||||||
|
b.HasIndex("usersid");
|
||||||
|
|
||||||
|
b.ToTable("roleuser");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Yi.Framework.Model.Models.menu", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Yi.Framework.Model.Models.menu", null)
|
||||||
|
.WithMany("children")
|
||||||
|
.HasForeignKey("menuid");
|
||||||
|
|
||||||
|
b.HasOne("Yi.Framework.Model.Models.mould", "mould")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("mouldid");
|
||||||
|
|
||||||
|
b.Navigation("mould");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("menurole", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Yi.Framework.Model.Models.menu", null)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("menusid")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("Yi.Framework.Model.Models.role", null)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("rolesid")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("roleuser", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Yi.Framework.Model.Models.role", null)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("rolesid")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("Yi.Framework.Model.Models.user", null)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("usersid")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Yi.Framework.Model.Models.menu", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("children");
|
||||||
|
});
|
||||||
#pragma warning restore 612, 618
|
#pragma warning restore 612, 618
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,6 @@ namespace Yi.Framework.Model.Models
|
|||||||
{
|
{
|
||||||
public string mould_name { get; set; }
|
public string mould_name { get; set; }
|
||||||
public string url { get; set; }
|
public string url { get; set; }
|
||||||
public menu menu { get; set; }
|
//public menu menu { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,8 +27,9 @@ namespace Yi.Framework.Service
|
|||||||
|
|
||||||
public async Task<menu> GetMenuByMould(mould _mould)
|
public async Task<menu> GetMenuByMould(mould _mould)
|
||||||
{
|
{
|
||||||
var mould_data= await _Db.Set<mould>().Include(u=>u.menu).Where(u => u.id == _mould.id&& u.is_delete == (short)Common.Enum.DelFlagEnum.Normal).FirstOrDefaultAsync();
|
throw new Exception();
|
||||||
return mould_data.menu;
|
//var mould_data= await _Db.Set<mould>().Include(u=>u.menu).Where(u => u.id == _mould.id&& u.is_delete == (short)Common.Enum.DelFlagEnum.Normal).FirstOrDefaultAsync();
|
||||||
|
// return mould_data.menu;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ namespace Yi.Framework.WebCore
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// appsettings.json操作类
|
/// appsettings.json操作类
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class Appsettings
|
public class Appsettings
|
||||||
{
|
{
|
||||||
static IConfiguration Configuration { get; set; }
|
static IConfiguration Configuration { get; set; }
|
||||||
static string contentPath { get; set; }
|
static string contentPath { get; set; }
|
||||||
@@ -26,7 +26,7 @@ namespace Yi.Framework.WebCore
|
|||||||
.Add(new JsonConfigurationSource { Path = Path, Optional = false, ReloadOnChange = true })//这样的话,可以直接读目录里的json文件,而不是 bin 文件夹下的,所以不用修改复制属性
|
.Add(new JsonConfigurationSource { Path = Path, Optional = false, ReloadOnChange = true })//这样的话,可以直接读目录里的json文件,而不是 bin 文件夹下的,所以不用修改复制属性
|
||||||
.Build();
|
.Build();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Appsettings(IConfiguration configuration)
|
public Appsettings(IConfiguration configuration)
|
||||||
{
|
{
|
||||||
Configuration = configuration;
|
Configuration = configuration;
|
||||||
@@ -60,10 +60,16 @@ namespace Yi.Framework.WebCore
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static T app<T>(params string[] sections)
|
public static T app<T>(params string[] sections)
|
||||||
{
|
{
|
||||||
List<T> list = new List<T>();
|
T app = Activator.CreateInstance<T>();
|
||||||
// 引用 Microsoft.Extensions.Configuration.Binder 包
|
// 引用 Microsoft.Extensions.Configuration.Binder 包
|
||||||
Configuration.Bind(string.Join(":", sections), list);
|
Configuration.Bind(string.Join(":", sections), app);
|
||||||
return list[0];
|
return app;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static IConfiguration appConfiguration(params string[] sections)
|
||||||
|
{
|
||||||
|
return Configuration.GetSection(string.Join(":", sections));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ namespace Yi.Framework.WebCore.FilterExtend
|
|||||||
{
|
{
|
||||||
#region Identity
|
#region Identity
|
||||||
private readonly ILogger<CustomActionCheckFilterAttribute> _logger;
|
private readonly ILogger<CustomActionCheckFilterAttribute> _logger;
|
||||||
private readonly IModelMetadataProvider _modelMetadataProvider;
|
|
||||||
public CustomActionCheckFilterAttribute(ILogger<CustomActionCheckFilterAttribute> logger)
|
public CustomActionCheckFilterAttribute(ILogger<CustomActionCheckFilterAttribute> logger)
|
||||||
{
|
{
|
||||||
this._logger = logger;
|
this._logger = logger;
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
using Microsoft.AspNetCore.Builder;
|
using Microsoft.AspNetCore.Builder;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.OpenApi.Models;
|
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
||||||
|
|||||||
@@ -1,27 +0,0 @@
|
|||||||
using Microsoft.AspNetCore.Builder;
|
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
|
||||||
using Microsoft.OpenApi.Models;
|
|
||||||
using System;
|
|
||||||
using System.IO;
|
|
||||||
using Yi.Framework.Common.IOCOptions;
|
|
||||||
|
|
||||||
namespace Yi.Framework.WebCore.MiddlewareExtend
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 数据库扩展
|
|
||||||
/// </summary>
|
|
||||||
public static class DataBaseExtension
|
|
||||||
{
|
|
||||||
public static IServiceCollection AddDataBaseService<IocOptios>(this IServiceCollection services , string appsettings)
|
|
||||||
{
|
|
||||||
Appsettings.app<IocOptios>(appsettings);
|
|
||||||
return services;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void UseDataBaseService(this IApplicationBuilder app)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
using Microsoft.AspNetCore.Builder;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.Extensions.Configuration;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using Yi.Framework.Model;
|
||||||
|
|
||||||
|
namespace Yi.Framework.WebCore.MiddlewareExtend
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 通用跨域扩展
|
||||||
|
/// </summary>
|
||||||
|
public static class IocExtension
|
||||||
|
{
|
||||||
|
public static IServiceCollection AddIocService(this IServiceCollection services, IConfiguration configuration)
|
||||||
|
{
|
||||||
|
#region
|
||||||
|
//配置文件使用配置
|
||||||
|
#endregion
|
||||||
|
services.AddSingleton(new Appsettings(configuration));
|
||||||
|
|
||||||
|
#region
|
||||||
|
//数据库配置
|
||||||
|
#endregion
|
||||||
|
services.AddScoped<DbContext, DataContext>();
|
||||||
|
|
||||||
|
return services;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -14,7 +14,7 @@ namespace Yi.Framework.WebCore.MiddlewareExtend
|
|||||||
{
|
{
|
||||||
public static IServiceCollection AddRabbitMQService(this IServiceCollection services)
|
public static IServiceCollection AddRabbitMQService(this IServiceCollection services)
|
||||||
{
|
{
|
||||||
Appsettings.app<RabbitMQOptions>("RabbitConn");
|
services.Configure<RabbitMQOptions>(Appsettings.appConfiguration("RabbitConn"));
|
||||||
return services;
|
return services;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ namespace Yi.Framework.WebCore.MiddlewareExtend
|
|||||||
{
|
{
|
||||||
public static IServiceCollection AddRedisService(this IServiceCollection services)
|
public static IServiceCollection AddRedisService(this IServiceCollection services)
|
||||||
{
|
{
|
||||||
Appsettings.app<RedisConnOptions>("RedisConn");
|
services.Configure<RedisConnOptions>(Appsettings.appConfiguration("RedisConn"));
|
||||||
return services;
|
return services;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
using Microsoft.AspNetCore.Builder;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using Yi.Framework.Common.IOCOptions;
|
||||||
|
|
||||||
|
namespace Yi.Framework.WebCore.MiddlewareExtend
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 数据库扩展
|
||||||
|
/// </summary>
|
||||||
|
public static class SqliteExtension
|
||||||
|
{
|
||||||
|
public static IServiceCollection AddSqliteService(this IServiceCollection services)
|
||||||
|
{
|
||||||
|
services.Configure<SqliteOptions>(Appsettings.appConfiguration("SqliteConn"));
|
||||||
|
return services;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -28,10 +28,10 @@ namespace Yi.Framework.WebCore.MiddlewareExtend
|
|||||||
//为 Swagger JSON and UI设置xml文档注释路径
|
//为 Swagger JSON and UI设置xml文档注释路径
|
||||||
//获取应用程序所在目录(绝对路径,不受工作目录影响,建议采用此方法获取路径使用windwos&Linux)
|
//获取应用程序所在目录(绝对路径,不受工作目录影响,建议采用此方法获取路径使用windwos&Linux)
|
||||||
var basePath = Path.GetDirectoryName(typeof(Program).Assembly.Location);
|
var basePath = Path.GetDirectoryName(typeof(Program).Assembly.Location);
|
||||||
var apiXmlPath = Path.Combine(basePath, @"ApiDoc.xml");//控制器层注释
|
var apiXmlPath = Path.Combine(basePath, @"SwaggerDoc.xml");//控制器层注释
|
||||||
var entityXmlPath = Path.Combine(basePath, @"SwaggerDoc.xml");//实体注释
|
//var entityXmlPath = Path.Combine(basePath, @"SwaggerDoc.xml");//实体注释
|
||||||
//c.IncludeXmlComments(apiXmlPath, true);//true表示显示控制器注释
|
//c.IncludeXmlComments(apiXmlPath, true);//true表示显示控制器注释
|
||||||
c.IncludeXmlComments(entityXmlPath);
|
c.IncludeXmlComments(apiXmlPath);
|
||||||
|
|
||||||
//添加控制器注释
|
//添加控制器注释
|
||||||
//c.DocumentFilter<SwaggerDocTag>();
|
//c.DocumentFilter<SwaggerDocTag>();
|
||||||
|
|||||||
@@ -9,10 +9,12 @@
|
|||||||
<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.Abstractions" Version="2.2.0" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Formatters.Json" Version="2.2.0" />
|
<PackageReference Include="Microsoft.AspNetCore.Mvc.Formatters.Json" Version="2.2.0" />
|
||||||
|
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.6.3" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Yi.Framework.Core\Yi.Framework.Core.csproj" />
|
<ProjectReference Include="..\Yi.Framework.Core\Yi.Framework.Core.csproj" />
|
||||||
|
<ProjectReference Include="..\Yi.Framework.Model\Yi.Framework.Model.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
Reference in New Issue
Block a user