添加rabc项目模块

This commit is contained in:
橙子
2023-01-29 21:13:20 +08:00
parent d6565bd2d9
commit bb8508abbd
38 changed files with 772 additions and 26 deletions

View File

@@ -69,6 +69,20 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.BBS.Web", "src\project\b
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.BBS.Application", "src\project\bbs\Yi.BBS.Application\Yi.BBS.Application.csproj", "{959A33C5-7826-4AE7-AC51-40BDC2B767B2}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "rbac", "rbac", "{07C9E949-DB5E-4315-A497-FF73746667D8}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.RBAC.Domain.Shared", "src\project\rbac\Yi.RBAC.Domain.Shared\Yi.RBAC.Domain.Shared.csproj", "{5467178B-3731-4346-A0A3-3CB1AC0953AB}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.RBAC.Domain", "src\project\rbac\Yi.RBAC.Domain\Yi.RBAC.Domain.csproj", "{2E082104-D3A6-40DE-A4E5-DE326B75A62D}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.RBAC.Sqlsugar", "src\project\rbac\Yi.RBAC.Sqlsugar\Yi.RBAC.Sqlsugar.csproj", "{ECF1AA6F-8FCD-428F-9648-2DAE3C345C96}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.RBAC.Application.Contracts", "src\project\rbac\Yi.RBAC.Application.Contracts\Yi.RBAC.Application.Contracts.csproj", "{478DA36E-F547-49CD-8B48-41DC5551C5C2}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.RBAC.Application", "src\project\rbac\Yi.RBAC.Application\Yi.RBAC.Application.csproj", "{2074EA00-59A4-49CE-97A6-735F4B77443B}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.RBAC.Web", "src\project\rbac\Yi.RBAC.Web\Yi.RBAC.Web.csproj", "{0C031C7D-6F80-4559-977C-AC001036EC44}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -187,6 +201,30 @@ Global
{959A33C5-7826-4AE7-AC51-40BDC2B767B2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{959A33C5-7826-4AE7-AC51-40BDC2B767B2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{959A33C5-7826-4AE7-AC51-40BDC2B767B2}.Release|Any CPU.Build.0 = Release|Any CPU
{5467178B-3731-4346-A0A3-3CB1AC0953AB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5467178B-3731-4346-A0A3-3CB1AC0953AB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5467178B-3731-4346-A0A3-3CB1AC0953AB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5467178B-3731-4346-A0A3-3CB1AC0953AB}.Release|Any CPU.Build.0 = Release|Any CPU
{2E082104-D3A6-40DE-A4E5-DE326B75A62D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2E082104-D3A6-40DE-A4E5-DE326B75A62D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2E082104-D3A6-40DE-A4E5-DE326B75A62D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2E082104-D3A6-40DE-A4E5-DE326B75A62D}.Release|Any CPU.Build.0 = Release|Any CPU
{ECF1AA6F-8FCD-428F-9648-2DAE3C345C96}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{ECF1AA6F-8FCD-428F-9648-2DAE3C345C96}.Debug|Any CPU.Build.0 = Debug|Any CPU
{ECF1AA6F-8FCD-428F-9648-2DAE3C345C96}.Release|Any CPU.ActiveCfg = Release|Any CPU
{ECF1AA6F-8FCD-428F-9648-2DAE3C345C96}.Release|Any CPU.Build.0 = Release|Any CPU
{478DA36E-F547-49CD-8B48-41DC5551C5C2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{478DA36E-F547-49CD-8B48-41DC5551C5C2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{478DA36E-F547-49CD-8B48-41DC5551C5C2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{478DA36E-F547-49CD-8B48-41DC5551C5C2}.Release|Any CPU.Build.0 = Release|Any CPU
{2074EA00-59A4-49CE-97A6-735F4B77443B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2074EA00-59A4-49CE-97A6-735F4B77443B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2074EA00-59A4-49CE-97A6-735F4B77443B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2074EA00-59A4-49CE-97A6-735F4B77443B}.Release|Any CPU.Build.0 = Release|Any CPU
{0C031C7D-6F80-4559-977C-AC001036EC44}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0C031C7D-6F80-4559-977C-AC001036EC44}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0C031C7D-6F80-4559-977C-AC001036EC44}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0C031C7D-6F80-4559-977C-AC001036EC44}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -222,6 +260,13 @@ Global
{A8043204-9DAC-4F08-8C73-423CB72927EF} = {B758A87D-0BFA-44A5-BA33-FBA44151CEB4}
{83BE964D-D53C-4D1B-B8C6-5306C393C07F} = {B758A87D-0BFA-44A5-BA33-FBA44151CEB4}
{959A33C5-7826-4AE7-AC51-40BDC2B767B2} = {B758A87D-0BFA-44A5-BA33-FBA44151CEB4}
{07C9E949-DB5E-4315-A497-FF73746667D8} = {32A813F5-13B2-4DCA-8B59-F27F1B0D5678}
{5467178B-3731-4346-A0A3-3CB1AC0953AB} = {07C9E949-DB5E-4315-A497-FF73746667D8}
{2E082104-D3A6-40DE-A4E5-DE326B75A62D} = {07C9E949-DB5E-4315-A497-FF73746667D8}
{ECF1AA6F-8FCD-428F-9648-2DAE3C345C96} = {07C9E949-DB5E-4315-A497-FF73746667D8}
{478DA36E-F547-49CD-8B48-41DC5551C5C2} = {07C9E949-DB5E-4315-A497-FF73746667D8}
{2074EA00-59A4-49CE-97A6-735F4B77443B} = {07C9E949-DB5E-4315-A497-FF73746667D8}
{0C031C7D-6F80-4559-977C-AC001036EC44} = {07C9E949-DB5E-4315-A497-FF73746667D8}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {6C1A3808-0F4F-43FB-A9FE-5F27A3BB2ECF}

View File

@@ -14,38 +14,38 @@ TemplateFactory templateFactory = new();
//string modelName = "Exhibition";
//string nameSpaces = "Yi.BBS";
//List<string> entityNames = new() { "Banner" };
string modelName = "Forum";
string nameSpaces = "Yi.BBS";
List<string> entityNames = new() { "_" };
//string modelName = "Forum";
//string nameSpaces = "Yi.BBS";
//List<string> entityNames = new() { "_" };
foreach (var entityName in entityNames)
{
templateFactory.CreateTemplateProviders((option) =>
{
option.Add(new ServiceTemplateProvider(modelName, entityName, nameSpaces));
option.Add(new IServiceTemplateProvider(modelName, entityName, nameSpaces));
//foreach (var entityName in entityNames)
//{
// templateFactory.CreateTemplateProviders((option) =>
// {
// option.Add(new ServiceTemplateProvider(modelName, entityName, nameSpaces));
// option.Add(new IServiceTemplateProvider(modelName, entityName, nameSpaces));
option.Add(new CreateInputVoTemplateProvider(modelName, entityName, nameSpaces));
option.Add(new UpdateInputVoTemplateProvider(modelName, entityName, nameSpaces));
option.Add(new GetListInputVoTemplateProvider(modelName, entityName, nameSpaces));
option.Add(new GetListOutputDtoTemplateProvider(modelName, entityName, nameSpaces));
option.Add(new GetOutputDtoTemplateProvider(modelName, entityName, nameSpaces));
// option.Add(new CreateInputVoTemplateProvider(modelName, entityName, nameSpaces));
// option.Add(new UpdateInputVoTemplateProvider(modelName, entityName, nameSpaces));
// option.Add(new GetListInputVoTemplateProvider(modelName, entityName, nameSpaces));
// option.Add(new GetListOutputDtoTemplateProvider(modelName, entityName, nameSpaces));
// option.Add(new GetOutputDtoTemplateProvider(modelName, entityName, nameSpaces));
option.Add(new ConstTemplateProvider(modelName, entityName, nameSpaces));
option.Add(new ProfileTemplateProvider(modelName, entityName, nameSpaces));
//option.Add(new ApiTemplateProvider(modelName, entityName));
});
//开始构建模板
templateFactory.BuildTemplate();
Console.WriteLine($"Yi.Framework.Template:{entityName}构建完成!");
}
// option.Add(new ConstTemplateProvider(modelName, entityName, nameSpaces));
// option.Add(new ProfileTemplateProvider(modelName, entityName, nameSpaces));
// //option.Add(new ApiTemplateProvider(modelName, entityName));
// });
// //开始构建模板
// templateFactory.BuildTemplate();
// Console.WriteLine($"Yi.Framework.Template:{entityName}构建完成!");
//}
Console.WriteLine("Yi.Framework.Template:模板全部生成完成!");
Console.ReadKey();
//Console.WriteLine("Yi.Framework.Template:模板全部生成完成!");
//Console.ReadKey();
//根据模板文件生成项目文件
//var template = "D:\\C#\\Yi\\Yi.Framework.Net6\\src\\project\\template";
//FileHelper.AllInfoReplace(template, "Template", "RBAC");
var template = "D:\\C#\\Yi\\Yi.Framework.Net6\\src\\project\\rbac";
FileHelper.AllInfoReplace(template, "Template", "RBAC");

View File

@@ -13,6 +13,7 @@
<ItemGroup>
<ProjectReference Include="..\..\..\framework\Yi.Framework.Auth.JwtBearer\Yi.Framework.Auth.JwtBearer.csproj" />
<ProjectReference Include="..\..\..\framework\Yi.Framework.Uow\Yi.Framework.Uow.csproj" />
<ProjectReference Include="..\..\rbac\Yi.RBAC.Application\Yi.RBAC.Application.csproj" />
<ProjectReference Include="..\Yi.BBS.Application.Contracts\Yi.BBS.Application.Contracts.csproj" />
<ProjectReference Include="..\Yi.BBS.Domain\Yi.BBS.Domain.csproj" />
</ItemGroup>

View File

@@ -12,13 +12,16 @@ using Yi.Framework.Core.Attributes;
using Yi.Framework.Data;
using Yi.Framework.Ddd;
using Yi.BBS.Domain;
using Yi.RBAC.Application;
namespace Yi.BBS.Application
{
[DependsOn(
typeof(YiRBACApplicationModule),
typeof(YiBBSApplicationContractsModule),
typeof(YiBBSDomainModule),
typeof(YiFrameworkAuthJwtBearerModule)
)]
public class YiBBSApplicationModule : IStartupModule
{

View File

@@ -7,6 +7,7 @@ using Yi.BBS.Application;
using Yi.BBS.Sqlsugar;
using Yi.Framework.AspNetCore.Microsoft.Extensions.DependencyInjection;
using Yi.Framework.Core.Autofac;
using Yi.RBAC.Application;
namespace Yi.BBS.Web
{
@@ -25,6 +26,7 @@ namespace Yi.BBS.Web
{
//NETServiceTest所在程序集添加进动态api配置
opt.CreateConventional(typeof(YiBBSApplicationModule).Assembly, option => option.RootPath = string.Empty);
opt.CreateConventional(typeof(YiRBACApplicationModule).Assembly, option => option.RootPath = string.Empty);
});
//添加swagger

View File

@@ -0,0 +1,3 @@
global using Yi.Framework.Core.Attributes;
global using Yi.Framework.Core.Helper;
global using Yi.Framework.Core.Model;

View File

@@ -0,0 +1,18 @@
<?xml version="1.0"?>
<doc>
<assembly>
<name>Yi.RBAC.Application.Contracts</name>
</assembly>
<members>
<member name="T:Yi.RBAC.Application.Contracts.School.Dtos.StudentCreateInputVo">
<summary>
Student输入创建对象
</summary>
</member>
<member name="T:Yi.RBAC.Application.Contracts.School.IStudentService">
<summary>
Student
</summary>
</member>
</members>
</doc>

View File

@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Yi.Framework.Ddd.Dtos;
namespace Yi.RBAC.Application.Contracts.School.Dtos
{
public class StudentGetOutputDto : IEntityDto<long>
{
public long Id { get; set; }
public string Name { get; set; }
public int? Height { get; set; }
public string? Phone { get; set; }
}
}

View File

@@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.RBAC.Application.Contracts.School.Dtos
{
/// <summary>
/// Student输入创建对象
/// </summary>
public class StudentCreateInputVo
{
public long Id { get; set; }
public string Name { get; set; }
public int? Height { get; set; }
public string? Phone { get; set; }
}
}

View File

@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Yi.Framework.Ddd.Dtos;
namespace Yi.RBAC.Application.Contracts.School.Dtos
{
public class StudentGetListInputVo : PagedAndSortedResultRequestDto
{
public long Id { get; set; }
public string Name { get; set; }
public int? Height { get; set; }
public string? Phone { get; set; }
}
}

View File

@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Yi.Framework.Ddd.Dtos;
namespace Yi.RBAC.Application.Contracts.School.Dtos
{
public class StudentGetListOutputDto : IEntityDto<long>
{
public long Id { get; set; }
public string Name { get; set; }
public int? Height { get; set; }
public string? Phone { get; set; }
}
}

View File

@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.RBAC.Application.Contracts.School.Dtos
{
public class StudentUpdateInputVo
{
public long Id { get; set; }
public string Name { get; set; }
public int? Height { get; set; }
public string? Phone { get; set; }
}
}

View File

@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Yi.RBAC.Application.Contracts.School.Dtos;
using Yi.Framework.Ddd.Services.Abstract;
namespace Yi.RBAC.Application.Contracts.School
{
/// <summary>
/// Student
/// </summary>
public interface IStudentService : ICrudAppService<StudentGetOutputDto, StudentGetListOutputDto, long, StudentGetListInputVo, StudentCreateInputVo, StudentUpdateInputVo>
{
}
}

View File

@@ -0,0 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
<DocumentationFile>./ApplicationContractsSwaggerDoc.xml</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\GlobalUsings.cs" Link="Properties\GlobalUsings.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Yi.RBAC.Domain.Shared\Yi.RBAC.Domain.Shared.csproj" />
</ItemGroup>
<ItemGroup>
<None Update="ApplicationContractsSwaggerDoc.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>

View File

@@ -0,0 +1,27 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using StartupModules;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Yi.Framework.Core.Attributes;
using Yi.RBAC.Domain.Shared;
namespace Yi.RBAC.Application.Contracts
{
[DependsOn(
typeof(YiRBACDomainSharedModule)
)]
public class YiRBACApplicationContractsModule : IStartupModule
{
public void Configure(IApplicationBuilder app, ConfigureMiddlewareContext context)
{
}
public void ConfigureServices(IServiceCollection services, ConfigureServicesContext context)
{
}
}
}

View File

@@ -0,0 +1,13 @@
<?xml version="1.0"?>
<doc>
<assembly>
<name>Yi.RBAC.Application</name>
</assembly>
<members>
<member name="T:Yi.RBAC.Application.School.StudentService">
<summary>
Student服务实现
</summary>
</member>
</members>
</doc>

View File

@@ -0,0 +1,23 @@
using AutoMapper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Yi.RBAC.Application.Contracts.School.Dtos;
using Yi.RBAC.Domain.School.Entities;
namespace Yi.RBAC.Application.School.MapperConfig
{
public class StudentProfile: Profile
{
public StudentProfile()
{
CreateMap<StudentGetListInputVo, StudentEntity>();
CreateMap<StudentCreateInputVo, StudentEntity>();
CreateMap<StudentUpdateInputVo, StudentEntity>();
CreateMap<StudentEntity, StudentGetListOutputDto>();
CreateMap<StudentEntity, StudentGetOutputDto>();
}
}
}

View File

@@ -0,0 +1,17 @@
using Yi.RBAC.Application.Contracts.School;
using NET.AutoWebApi.Setting;
using Yi.RBAC.Application.Contracts.School.Dtos;
using Yi.RBAC.Domain.School.Entities;
using Yi.Framework.Ddd.Services;
namespace Yi.RBAC.Application.School
{
/// <summary>
/// Student服务实现
/// </summary>
[AppService]
public class StudentService : CrudAppService<StudentEntity, StudentGetOutputDto, StudentGetListOutputDto, long, StudentGetListInputVo, StudentCreateInputVo, StudentUpdateInputVo>,
IStudentService, IAutoApiService
{
}
}

View File

@@ -0,0 +1,25 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
<DocumentationFile>./ApplicationSwaggerDoc.xml</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\GlobalUsings.cs" Link="Properties\GlobalUsings.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\framework\Yi.Framework.Auth.JwtBearer\Yi.Framework.Auth.JwtBearer.csproj" />
<ProjectReference Include="..\..\..\framework\Yi.Framework.Uow\Yi.Framework.Uow.csproj" />
<ProjectReference Include="..\Yi.RBAC.Application.Contracts\Yi.RBAC.Application.Contracts.csproj" />
<ProjectReference Include="..\Yi.RBAC.Domain\Yi.RBAC.Domain.csproj" />
</ItemGroup>
<ItemGroup>
<None Update="ApplicationSwaggerDoc.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>

View File

@@ -0,0 +1,33 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using StartupModules;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Yi.RBAC.Application.Contracts;
using Yi.Framework.Auth.JwtBearer;
using Yi.Framework.Core.Attributes;
using Yi.Framework.Data;
using Yi.Framework.Ddd;
using Yi.RBAC.Domain;
namespace Yi.RBAC.Application
{
[DependsOn(
typeof(YiRBACApplicationContractsModule),
typeof(YiRBACDomainModule),
typeof(YiFrameworkAuthJwtBearerModule)
)]
public class YiRBACApplicationModule : IStartupModule
{
public void Configure(IApplicationBuilder app, ConfigureMiddlewareContext context)
{
}
public void ConfigureServices(IServiceCollection services, ConfigureServicesContext context)
{
}
}
}

View File

@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.RBAC.Domain.Shared.School.ConstClasses
{
/// <summary>
/// 常量定义
/// </summary>
public class StudentConst
{
}
}

View File

@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\GlobalUsings.cs" Link="Properties\GlobalUsings.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\framework\Yi.Framework.Ddd\Yi.Framework.Ddd.csproj" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,27 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using StartupModules;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Yi.Framework.Core.Attributes;
using Yi.Framework.Ddd;
namespace Yi.RBAC.Domain.Shared
{
[DependsOn(
typeof(YiFrameworkDddModule)
)]
public class YiRBACDomainSharedModule : IStartupModule
{
public void Configure(IApplicationBuilder app, ConfigureMiddlewareContext context)
{
}
public void ConfigureServices(IServiceCollection services, ConfigureServicesContext context)
{
}
}
}

View File

@@ -0,0 +1,8 @@
<?xml version="1.0"?>
<doc>
<assembly>
<name>Yi.RBAC.Domain</name>
</assembly>
<members>
</members>
</doc>

View File

@@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Yi.Framework.Data.DataSeeds;
using Yi.Framework.Ddd.Repositories;
using Yi.RBAC.Domain.School.Entities;
namespace Yi.RBAC.Domain.School.DataSeeds
{
[AppService(typeof(IDataSeed))]
public class StudentDataSeed : AbstractDataSeed<StudentEntity>
{
public StudentDataSeed(IRepository<StudentEntity> repository) : base(repository)
{
}
public override List<StudentEntity> GetSeedData()
{
return new List<StudentEntity>() { new StudentEntity { Id = SnowflakeHelper.NextId, Name = "你好", Phone = "123", Height = 188, IsDeleted = false } ,
new StudentEntity { Id = SnowflakeHelper.NextId, Name = "你好1", Phone = "123", Height = 188, IsDeleted = false },
new StudentEntity { Id = SnowflakeHelper.NextId, Name = "你好2", Phone = "123", Height = 188, IsDeleted = false }
};
}
}
}

View File

@@ -0,0 +1,25 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Yi.Framework.Data.Entities;
using Yi.Framework.Ddd.Entities;
namespace Yi.RBAC.Domain.School.Entities
{
[SugarTable("Student")]
public class StudentEntity : IEntity<long>,ISoftDelete
{
[SugarColumn(IsPrimaryKey = true)]
public long Id { get; set; }
public string Name { get; set; }
public int? Height { get; set; }
public string? Phone { get; set; }
public bool IsDeleted { get; set; } = false;
}
}

View File

@@ -0,0 +1,24 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
<DocumentationFile>./DomainSwaggerDoc.xml</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\GlobalUsings.cs" Link="Properties\GlobalUsings.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\framework\Yi.Framework.Data\Yi.Framework.Data.csproj" />
<ProjectReference Include="..\Yi.RBAC.Domain.Shared\Yi.RBAC.Domain.Shared.csproj" />
</ItemGroup>
<ItemGroup>
<None Update="DomainSwaggerDoc.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>

View File

@@ -0,0 +1,30 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using StartupModules;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Yi.Framework.Core.Attributes;
using Yi.Framework.Data;
using Yi.RBAC.Domain.Shared;
namespace Yi.RBAC.Domain
{
[DependsOn(
typeof(YiRBACDomainSharedModule),
typeof(YiFrameworkDataModule)
)]
public class YiRBACDomainModule : IStartupModule
{
public void Configure(IApplicationBuilder app, ConfigureMiddlewareContext context)
{
}
public void ConfigureServices(IServiceCollection services, ConfigureServicesContext context)
{
//services.AddTransient<StudentManager>();
}
}
}

View File

@@ -0,0 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\GlobalUsings.cs" Link="Properties\GlobalUsings.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\framework\Yi.Framework.Core.Sqlsugar\Yi.Framework.Core.Sqlsugar.csproj" />
<ProjectReference Include="..\Yi.RBAC.Domain\Yi.RBAC.Domain.csproj" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,28 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using StartupModules;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Yi.Framework.Core.Attributes;
using Yi.Framework.Core.Sqlsugar;
using Yi.RBAC.Domain;
namespace Yi.RBAC.Sqlsugar
{
[DependsOn(typeof(YiFrameworkCoreSqlsugarModule),
typeof(YiRBACDomainModule))]
public class YiRBACSqlsugarModule : IStartupModule
{
public void Configure(IApplicationBuilder app, ConfigureMiddlewareContext context)
{
}
public void ConfigureServices(IServiceCollection services, ConfigureServicesContext context)
{
//services.AddTransient<IStudentRepository, StudentRepository>();
}
}
}

View File

@@ -0,0 +1,29 @@
using AspNetCore.Microsoft.AspNetCore.Hosting;
using Yi.Framework.Core.Autofac.Extensions;
using Yi.Framework.Core.Autofac.Modules;
using Yi.Framework.Core.Extensions;
using Yi.RBAC.Web;
var builder = WebApplication.CreateBuilder(args);
//设置启动url
builder.WebHost.UseStartUrlsServer(builder.Configuration);
//添加模块
builder.UseYiModules(typeof(YiRBACWebModule));
//添加autofac模块,需要添加模块
builder.Host.ConfigureAutoFacContainer(container =>
{
container.RegisterYiModule(AutoFacModuleEnum.PropertiesAutowiredModule, typeof(YiRBACWebModule).Assembly);
});
var app = builder.Build();
//全局错误中间件,需要放在最早
app.UseErrorHandlingServer();
app.UseAuthentication();
app.UseAuthorization();
app.MapControllers();
app.Run();

View File

@@ -0,0 +1,15 @@
{
"$schema": "https://json.schemastore.org/launchsettings.json",
"profiles": {
"Yi.RBAC.Web": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "swagger",
"applicationUrl": "http://localhost:19001",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}

View File

@@ -0,0 +1,27 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\GlobalUsings.cs" Link="Properties\GlobalUsings.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Yi.RBAC.Application\Yi.RBAC.Application.csproj" />
<ProjectReference Include="..\Yi.RBAC.Sqlsugar\Yi.RBAC.Sqlsugar.csproj" />
</ItemGroup>
<ItemGroup>
<None Update="key.pem">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="public.pem">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>

View File

@@ -0,0 +1,44 @@
using AspNetCore.Microsoft.AspNetCore.Builder;
using StartupModules;
using Yi.Framework.Auth.JwtBearer;
using Yi.Framework.Core;
using Yi.Framework.Core.Attributes;
using Yi.RBAC.Application;
using Yi.RBAC.Sqlsugar;
namespace Yi.RBAC.Web
{
[DependsOn(
typeof(YiRBACSqlsugarModule),
typeof(YiRBACApplicationModule)
)]
public class YiRBACWebModule : IStartupModule
{
public void ConfigureServices(IServiceCollection services, ConfigureServicesContext context)
{
//添加控制器与动态api
services.AddControllers();
services.AddAutoApiService(opt =>
{
//NETServiceTest所在程序集添加进动态api配置
opt.CreateConventional(typeof(YiRBACApplicationModule).Assembly, option => option.RootPath = string.Empty);
});
//添加swagger
services.AddSwaggerServer<YiRBACApplicationModule>();
}
public void Configure(IApplicationBuilder app, ConfigureMiddlewareContext context)
{
//if (app.Environment.IsDevelopment())
{
app.UseSwaggerServer();
}
app.UseHttpsRedirection();
app.UseAuthorization();
app.UseRouting();
}
}
}

View File

@@ -0,0 +1,40 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*",
//程序启动地址,*代表全部网口
"StartUrl": "http://*:19002",
//数据库类型列表
"DbList": [ "Sqlite", "Mysql", "Sqlserver", "Oracle" ],
"DbConnOptions": {
"Url": "DataSource=yi-sqlsugar-dev.db",
"DbType": "Sqlite",
"EnabledDbSeed": false,
"EnabledReadWrite": false,
"EnabledCodeFirst": true,
"EntityAssembly": null,
"ReadUrl": [
"DataSource=[xxxx]", //sqlite
"server=[xxxx];port=3306;database=[xxxx];user id=[xxxx];password=[xxxx]", //mysql
"Data Source=[xxxx];Initial Catalog=[xxxx];User ID=[xxxx];password=[xxxx]" //sqlserver
]
},
//授权
"JwtTokenOptions": {
"Audience": "yi",
"Issuer": "localhost:19002",
"Subject": "yiframwork",
"ExpSecond": 3600
},
//开启种子数据
"EnabledDataSeed": true
}

View File

@@ -0,0 +1,28 @@
-----BEGIN PRIVATE KEY-----
MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQC7VJTUt9Us8cKj
MzEfYyjiWA4R4/M2bS1GB4t7NXp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