添加bbs模块

This commit is contained in:
橙子
2023-01-24 20:28:33 +08:00
parent 67ca25cec4
commit 8a9c7e54e2
35 changed files with 740 additions and 3 deletions

View File

@@ -57,6 +57,18 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "template", "template", "{A3
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "bbs", "bbs", "{B758A87D-0BFA-44A5-BA33-FBA44151CEB4}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.BBS.Domain.Shared", "src\project\BBS\Yi.BBS.Domain.Shared\Yi.BBS.Domain.Shared.csproj", "{DEA3342F-1954-4EE9-9A59-CAF1D7832F33}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.BBS.Domain", "src\project\BBS\Yi.BBS.Domain\Yi.BBS.Domain.csproj", "{86C82BB6-E333-40E8-8DDE-20C3A538433C}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.BBS.Application.Contracts", "src\project\BBS\Yi.BBS.Application.Contracts\Yi.BBS.Application.Contracts.csproj", "{679625DD-4BF6-4CD6-99FD-7A3E6D9B04A1}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.BBS.Sqlsugar", "src\project\BBS\Yi.BBS.Sqlsugar\Yi.BBS.Sqlsugar.csproj", "{A8043204-9DAC-4F08-8C73-423CB72927EF}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.BBS.Web", "src\project\BBS\Yi.BBS.Web\Yi.BBS.Web.csproj", "{83BE964D-D53C-4D1B-B8C6-5306C393C07F}"
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
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -151,6 +163,30 @@ Global
{134C4AB9-2AFE-4383-84DE-825DF9499CB4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{134C4AB9-2AFE-4383-84DE-825DF9499CB4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{134C4AB9-2AFE-4383-84DE-825DF9499CB4}.Release|Any CPU.Build.0 = Release|Any CPU
{DEA3342F-1954-4EE9-9A59-CAF1D7832F33}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DEA3342F-1954-4EE9-9A59-CAF1D7832F33}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DEA3342F-1954-4EE9-9A59-CAF1D7832F33}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DEA3342F-1954-4EE9-9A59-CAF1D7832F33}.Release|Any CPU.Build.0 = Release|Any CPU
{86C82BB6-E333-40E8-8DDE-20C3A538433C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{86C82BB6-E333-40E8-8DDE-20C3A538433C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{86C82BB6-E333-40E8-8DDE-20C3A538433C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{86C82BB6-E333-40E8-8DDE-20C3A538433C}.Release|Any CPU.Build.0 = Release|Any CPU
{679625DD-4BF6-4CD6-99FD-7A3E6D9B04A1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{679625DD-4BF6-4CD6-99FD-7A3E6D9B04A1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{679625DD-4BF6-4CD6-99FD-7A3E6D9B04A1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{679625DD-4BF6-4CD6-99FD-7A3E6D9B04A1}.Release|Any CPU.Build.0 = Release|Any CPU
{A8043204-9DAC-4F08-8C73-423CB72927EF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A8043204-9DAC-4F08-8C73-423CB72927EF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A8043204-9DAC-4F08-8C73-423CB72927EF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A8043204-9DAC-4F08-8C73-423CB72927EF}.Release|Any CPU.Build.0 = Release|Any CPU
{83BE964D-D53C-4D1B-B8C6-5306C393C07F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{83BE964D-D53C-4D1B-B8C6-5306C393C07F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{83BE964D-D53C-4D1B-B8C6-5306C393C07F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{83BE964D-D53C-4D1B-B8C6-5306C393C07F}.Release|Any CPU.Build.0 = Release|Any CPU
{959A33C5-7826-4AE7-AC51-40BDC2B767B2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{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
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -180,6 +216,12 @@ Global
{134C4AB9-2AFE-4383-84DE-825DF9499CB4} = {EEF5F221-0E32-4A3D-B647-B4B5E7305806}
{A3707874-7890-42AF-A686-E3AACD6F108C} = {32A813F5-13B2-4DCA-8B59-F27F1B0D5678}
{B758A87D-0BFA-44A5-BA33-FBA44151CEB4} = {32A813F5-13B2-4DCA-8B59-F27F1B0D5678}
{DEA3342F-1954-4EE9-9A59-CAF1D7832F33} = {B758A87D-0BFA-44A5-BA33-FBA44151CEB4}
{86C82BB6-E333-40E8-8DDE-20C3A538433C} = {B758A87D-0BFA-44A5-BA33-FBA44151CEB4}
{679625DD-4BF6-4CD6-99FD-7A3E6D9B04A1} = {B758A87D-0BFA-44A5-BA33-FBA44151CEB4}
{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}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {6C1A3808-0F4F-43FB-A9FE-5F27A3BB2ECF}

View File

@@ -28,7 +28,7 @@ foreach (var entityName in entityNames)
//option.Add(new ApiTemplateProvider(modelName, entityName));
});
//开始构建模板
templateFactory.BuildTemplate();
//templateFactory.BuildTemplate();
Console.WriteLine($"Yi.Framework.Template:{entityName}构建完成!");
}
@@ -36,5 +36,5 @@ Console.WriteLine("Yi.Framework.Template:模板全部生成完成!");
Console.ReadKey();
//根据模板文件生成项目文件
//var template = "";
//FileHelper.AllInfoReplace(template, "Template","BBS");
//var template = "D:\\C#\\Yi\\Yi.Framework.Net6\\src\\project\\BBS";
//FileHelper.AllInfoReplace(template, "Template", "BBS");

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.BBS.Application.Contracts</name>
</assembly>
<members>
<member name="T:Yi.BBS.Application.Contracts.School.Dtos.StudentCreateInputVo">
<summary>
Student输入创建对象
</summary>
</member>
<member name="T:Yi.BBS.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.BBS.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.BBS.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.BBS.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.BBS.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.BBS.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.BBS.Application.Contracts.School.Dtos;
using Yi.Framework.Ddd.Services.Abstract;
namespace Yi.BBS.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.BBS.Domain.Shared\Yi.BBS.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.BBS.Domain.Shared;
namespace Yi.BBS.Application.Contracts
{
[DependsOn(
typeof(YiBBSDomainSharedModule)
)]
public class YiBBSApplicationContractsModule : 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.BBS.Application</name>
</assembly>
<members>
<member name="T:Yi.BBS.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.BBS.Application.Contracts.School.Dtos;
using Yi.BBS.Domain.School.Entities;
namespace Yi.BBS.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.BBS.Application.Contracts.School;
using NET.AutoWebApi.Setting;
using Yi.BBS.Application.Contracts.School.Dtos;
using Yi.BBS.Domain.School.Entities;
using Yi.Framework.Ddd.Services;
namespace Yi.BBS.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.BBS.Application.Contracts\Yi.BBS.Application.Contracts.csproj" />
<ProjectReference Include="..\Yi.BBS.Domain\Yi.BBS.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.BBS.Application.Contracts;
using Yi.Framework.Auth.JwtBearer;
using Yi.Framework.Core.Attributes;
using Yi.Framework.Data;
using Yi.Framework.Ddd;
using Yi.BBS.Domain;
namespace Yi.BBS.Application
{
[DependsOn(
typeof(YiBBSApplicationContractsModule),
typeof(YiBBSDomainModule),
typeof(YiFrameworkAuthJwtBearerModule)
)]
public class YiBBSApplicationModule : 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.BBS.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.BBS.Domain.Shared
{
[DependsOn(
typeof(YiFrameworkDddModule)
)]
public class YiBBSDomainSharedModule : 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.BBS.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.BBS.Domain.School.Entities;
namespace Yi.BBS.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.BBS.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.BBS.Domain.Shared\Yi.BBS.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.BBS.Domain.Shared;
namespace Yi.BBS.Domain
{
[DependsOn(
typeof(YiBBSDomainSharedModule),
typeof(YiFrameworkDataModule)
)]
public class YiBBSDomainModule : 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.BBS.Domain\Yi.BBS.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.BBS.Domain;
namespace Yi.BBS.Sqlsugar
{
[DependsOn(typeof(YiFrameworkCoreSqlsugarModule),
typeof(YiBBSDomainModule))]
public class YiBBSSqlsugarModule : 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.BBS.Web;
var builder = WebApplication.CreateBuilder(args);
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>url
builder.WebHost.UseStartUrlsServer(builder.Configuration);
//<2F><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>
builder.UseYiModules(typeof(YiBBSWebModule));
//<2F><><EFBFBD><EFBFBD>autofacģ<63><C4A3>,<2C><>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>
builder.Host.ConfigureAutoFacContainer(container =>
{
container.RegisterYiModule(AutoFacModuleEnum.PropertiesAutowiredModule, typeof(YiBBSWebModule).Assembly);
});
var app = builder.Build();
//ȫ<>ִ<EFBFBD><D6B4><EFBFBD><EFBFBD>м<EFBFBD><D0BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
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.BBS.Web": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "swagger",
"applicationUrl": "http://localhost:19002",
"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.BBS.Application\Yi.BBS.Application.csproj" />
<ProjectReference Include="..\Yi.BBS.Sqlsugar\Yi.BBS.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.BBS.Application;
using Yi.BBS.Sqlsugar;
namespace Yi.BBS.Web
{
[DependsOn(
typeof(YiBBSSqlsugarModule),
typeof(YiBBSApplicationModule)
)]
public class YiBBSWebModule : IStartupModule
{
public void ConfigureServices(IServiceCollection services, ConfigureServicesContext context)
{
//添加控制器与动态api
services.AddControllers();
services.AddAutoApiService(opt =>
{
//NETServiceTest所在程序集添加进动态api配置
opt.CreateConventional(typeof(YiBBSApplicationModule).Assembly, option => option.RootPath = string.Empty);
});
//添加swagger
services.AddSwaggerServer<YiBBSApplicationModule>();
}
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/M2bS1GB4t7NXp98C3SC6dVMvDuictGeurT8jNbvJZHtCSuYEvu
NMoSfm76oqFvAp8Gy0iz5sxjZmSnXyCdPEovGhLa0VzMaQ8s+CLOyS56YyCFGeJZ
qgtzJ6GR3eqoYSW9b9UMvkBpZODSctWSNGj3P7jRFDO5VoTwCQAWbFnOjDfH5Ulg
p2PKSQnSJP3AJLQNFNe7br1XbrhV//eO+t51mIpGSDCUv3E0DDFcWDTH9cXDTTlR
ZVEiR2BwpZOOkE/Z0/BVnhZYL71oZV34bKfWjQIt6V/isSMahdsAASACp4ZTGtwi
VuNd9tybAgMBAAECggEBAKTmjaS6tkK8BlPXClTQ2vpz/N6uxDeS35mXpqasqskV
laAidgg/sWqpjXDbXr93otIMLlWsM+X0CqMDgSXKejLS2jx4GDjI1ZTXg++0AMJ8
sJ74pWzVDOfmCEQ/7wXs3+cbnXhKriO8Z036q92Qc1+N87SI38nkGa0ABH9CN83H
mQqt4fB7UdHzuIRe/me2PGhIq5ZBzj6h3BpoPGzEP+x3l9YmK8t/1cN0pqI+dQwY
dgfGjackLu/2qH80MCF7IyQaseZUOJyKrCLtSD/Iixv/hzDEUPfOCjFDgTpzf3cw
ta8+oE4wHCo1iI1/4TlPkwmXx4qSXtmw4aQPz7IDQvECgYEA8KNThCO2gsC2I9PQ
DM/8Cw0O983WCDY+oi+7JPiNAJwv5DYBqEZB1QYdj06YD16XlC/HAZMsMku1na2T
N0driwenQQWzoev3g2S7gRDoS/FCJSI3jJ+kjgtaA7Qmzlgk1TxODN+G1H91HW7t
0l7VnL27IWyYo2qRRK3jzxqUiPUCgYEAx0oQs2reBQGMVZnApD1jeq7n4MvNLcPv
t8b/eU9iUv6Y4Mj0Suo/AU8lYZXm8ubbqAlwz2VSVunD2tOplHyMUrtCtObAfVDU
AhCndKaA9gApgfb3xw1IKbuQ1u4IF1FJl3VtumfQn//LiH1B3rXhcdyo3/vIttEk
48RakUKClU8CgYEAzV7W3COOlDDcQd935DdtKBFRAPRPAlspQUnzMi5eSHMD/ISL
DY5IiQHbIH83D4bvXq0X7qQoSBSNP7Dvv3HYuqMhf0DaegrlBuJllFVVq9qPVRnK
xt1Il2HgxOBvbhOT+9in1BzA+YJ99UzC85O0Qz06A+CmtHEy4aZ2kj5hHjECgYEA
mNS4+A8Fkss8Js1RieK2LniBxMgmYml3pfVLKGnzmng7H2+cwPLhPIzIuwytXywh
2bzbsYEfYx3EoEVgMEpPhoarQnYPukrJO4gwE2o5Te6T5mJSZGlQJQj9q4ZB2Dfz
et6INsK0oG8XVGXSpQvQh3RUYekCZQkBBFcpqWpbIEsCgYAnM3DQf3FJoSnXaMhr
VBIovic5l0xFkEHskAjFTevO86Fsz1C2aSeRKSqGFoOQ0tmJzBEs1R6KqnHInicD
TQrKhArgLXX4v3CddjfTRJkFWDbE/CkvKZNOrcf1nhaGCPspRJj2KUkj1Fhl9Cnc
dn/RsYEONbwQSjIfMPkvxF+8HQ==
-----END PRIVATE KEY-----

View File

@@ -0,0 +1,9 @@
-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAu1SU1LfVLPHCozMxH2Mo
4lgOEePzNm0tRgeLezV6ffAt0gunVTLw7onLRnrq0/IzW7yWR7QkrmBL7jTKEn5u
+qKhbwKfBstIs+bMY2Zkp18gnTxKLxoS2tFczGkPLPgizskuemMghRniWaoLcyeh
kd3qqGElvW/VDL5AaWTg0nLVkjRo9z+40RQzuVaE8AkAFmxZzow3x+VJYKdjykkJ
0iT9wCS0DRTXu269V264Vf/3jvredZiKRkgwlL9xNAwxXFg0x/XFw005UWVRIkdg
cKWTjpBP2dPwVZ4WWC+9aGVd+Gyn1o0CLelf4rEjGoXbAAEgAqeGUxrcIlbjXfbc
mwIDAQAB
-----END PUBLIC KEY-----