diff --git a/Yi.Framework.Net6/src/framework/Yi.Framework.Auth.JwtBearer/YiFrameworkAuthJwtBearerModule.cs b/Yi.Framework.Net6/src/framework/Yi.Framework.Auth.JwtBearer/YiFrameworkAuthJwtBearerModule.cs index 7016597f..9802d973 100644 --- a/Yi.Framework.Net6/src/framework/Yi.Framework.Auth.JwtBearer/YiFrameworkAuthJwtBearerModule.cs +++ b/Yi.Framework.Net6/src/framework/Yi.Framework.Auth.JwtBearer/YiFrameworkAuthJwtBearerModule.cs @@ -32,7 +32,7 @@ namespace Yi.Framework.Auth.JwtBearer { option.AddScheme(YiJwtAuthenticationHandler.YiJwtSchemeName, YiJwtAuthenticationHandler.YiJwtSchemeName); }); - services.AddSingleton(); + //services.AddSingleton(); //services.AddControllers(options => { // options.Filters.Add(); //}); diff --git a/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Sqlsugar/Yi.BBS.Sqlsugar.csproj b/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Sqlsugar/Yi.BBS.Sqlsugar.csproj index e5308a54..96d709be 100644 --- a/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Sqlsugar/Yi.BBS.Sqlsugar.csproj +++ b/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Sqlsugar/Yi.BBS.Sqlsugar.csproj @@ -11,6 +11,7 @@ + diff --git a/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Sqlsugar/YiBBSSqlsugarModule.cs b/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Sqlsugar/YiBBSSqlsugarModule.cs index 39bc5efa..83db7933 100644 --- a/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Sqlsugar/YiBBSSqlsugarModule.cs +++ b/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Sqlsugar/YiBBSSqlsugarModule.cs @@ -9,11 +9,13 @@ using System.Threading.Tasks; using Yi.Framework.Core.Attributes; using Yi.Framework.Core.Sqlsugar; using Yi.BBS.Domain; +using Yi.RBAC.Sqlsugar; namespace Yi.BBS.Sqlsugar { [DependsOn(typeof(YiFrameworkCoreSqlsugarModule), - typeof(YiBBSDomainModule))] + typeof(YiBBSDomainModule), + typeof(YiRBACSqlsugarModule))] public class YiBBSSqlsugarModule : IStartupModule { public void Configure(IApplicationBuilder app, ConfigureMiddlewareContext context) diff --git a/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Web/Program.cs b/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Web/Program.cs index 7959e994..5d0af2e6 100644 --- a/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Web/Program.cs +++ b/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Web/Program.cs @@ -4,6 +4,7 @@ using Yi.Framework.Core.Autofac.Modules; using Yi.Framework.Core.Extensions; using Yi.BBS.Web; using Yi.BBS.Application; +using Yi.RBAC.Application; var builder = WebApplication.CreateBuilder(args); builder.WebHost.UseStartUrlsServer(builder.Configuration); @@ -12,7 +13,9 @@ builder.UseYiModules(typeof(YiBBSWebModule)); builder.Host.ConfigureAutoFacContainer(container => { - container.RegisterYiModule(AutoFacModuleEnum.PropertiesAutowiredModule,typeof(YiBBSWebModule).Assembly , typeof(YiBBSApplicationModule).Assembly); + container.RegisterYiModule(AutoFacModuleEnum.PropertiesAutowiredModule, + typeof(YiBBSApplicationModule).Assembly, + typeof(YiRBACApplicationModule).Assembly); }); var app = builder.Build(); diff --git a/Yi.Framework.Net6/src/project/Template/Yi.Template.Web/Program.cs b/Yi.Framework.Net6/src/project/Template/Yi.Template.Web/Program.cs index 2b788ad7..be0db32c 100644 --- a/Yi.Framework.Net6/src/project/Template/Yi.Template.Web/Program.cs +++ b/Yi.Framework.Net6/src/project/Template/Yi.Template.Web/Program.cs @@ -2,6 +2,7 @@ using AspNetCore.Microsoft.AspNetCore.Hosting; using Yi.Framework.Core.Autofac.Extensions; using Yi.Framework.Core.Autofac.Modules; using Yi.Framework.Core.Extensions; +using Yi.Template.Application; using Yi.Template.Web; var builder = WebApplication.CreateBuilder(args); @@ -14,7 +15,7 @@ builder.UseYiModules(typeof(YiTemplateWebModule)); //添加autofac模块,需要添加模块 builder.Host.ConfigureAutoFacContainer(container => { - container.RegisterYiModule(AutoFacModuleEnum.PropertiesAutowiredModule, typeof(YiTemplateWebModule).Assembly); + container.RegisterYiModule(AutoFacModuleEnum.PropertiesAutowiredModule, typeof(YiTemplateApplicationModule).Assembly); }); var app = builder.Build(); diff --git a/Yi.Framework.Net6/src/project/Template/Yi.Template.Web/YiTemplateWebModule.cs b/Yi.Framework.Net6/src/project/Template/Yi.Template.Web/YiTemplateWebModule.cs index 9f2bf87f..c7623b63 100644 --- a/Yi.Framework.Net6/src/project/Template/Yi.Template.Web/YiTemplateWebModule.cs +++ b/Yi.Framework.Net6/src/project/Template/Yi.Template.Web/YiTemplateWebModule.cs @@ -3,12 +3,14 @@ using StartupModules; using Yi.Framework.Auth.JwtBearer; using Yi.Framework.Core; using Yi.Framework.Core.Attributes; +using Yi.Framework.Core.Autofac; using Yi.Template.Application; using Yi.Template.Sqlsugar; namespace Yi.Template.Web { [DependsOn( + typeof(YiFrameworkCoreAutofacModule), typeof(YiTemplateSqlsugarModule), typeof(YiTemplateApplicationModule) )] diff --git a/Yi.Framework.Net6/src/project/bbs/GlobalUsings.cs b/Yi.Framework.Net6/src/project/bbs/GlobalUsings.cs new file mode 100644 index 00000000..d6ecb816 --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/GlobalUsings.cs @@ -0,0 +1,4 @@ +global using Yi.Framework.Core.Attributes; +global using Yi.Framework.Core.Helper; +global using Yi.Framework.Core.Model; +global using Yi.Framework.Core.Exceptions; \ No newline at end of file diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/ApplicationContractsSwaggerDoc.xml b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/ApplicationContractsSwaggerDoc.xml new file mode 100644 index 00000000..fc82778f --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/ApplicationContractsSwaggerDoc.xml @@ -0,0 +1,79 @@ + + + + Yi.BBS.Application.Contracts + + + + + Banner输入创建对象 + + + + + Banner抽象 + + + + + Article输入创建对象 + + + + + Comment输入创建对象 + + + + + Discuss输入创建对象 + + + + + Label输入创建对象 + + + + + Plate输入创建对象 + + + + + Article服务抽象 + + + + + Comment服务抽象 + + + + + Discuss服务抽象 + + + + + Label服务抽象 + + + + + Plate服务抽象 + + + + + Setting应用抽象 + + + + + 获取配置标题 + + + + + diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Yi.BBS.Application.Contracts.csproj b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Yi.BBS.Application.Contracts.csproj new file mode 100644 index 00000000..346b1043 --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Yi.BBS.Application.Contracts.csproj @@ -0,0 +1,23 @@ + + + + net6.0 + enable + enable + True + ./ApplicationContractsSwaggerDoc.xml + + + + + + + + + + + Always + + + + diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/YiBBSApplicationContractsModule.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/YiBBSApplicationContractsModule.cs new file mode 100644 index 00000000..d968104f --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/YiBBSApplicationContractsModule.cs @@ -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) + { + } + } +} diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application/ApplicationSwaggerDoc.xml b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application/ApplicationSwaggerDoc.xml new file mode 100644 index 00000000..9dc71566 --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application/ApplicationSwaggerDoc.xml @@ -0,0 +1,150 @@ + + + + Yi.BBS.Application + + + + + Banner服务实现 + + + + + Article服务实现 + + + + + 获取文章全部平铺信息 + + + + + + + + 查询文章 + + + + + + + + 发表文章 + + + + + + + + Comment服务实现 + + + + + 获取改主题下的评论 + + + + + + + + 发表评论 + + + + + + + + Discuss应用服务实现,用于参数效验、领域服务业务组合、日志记录、事务处理、账户信息 + + + + + 获取改板块下的主题 + + + + + + + + 创建主题 + + + + + + + Label服务实现 + + + + + 获取当前用户的主题类型 + + + + + + + 创建 + + + + + + + Plate服务实现 + + + + + Setting服务实现 + + + + + 获取配置标题 + + + + + + + 临时服务,之后用其他模块代替 + + + + + 登录 + + + + + + + 判断是否有登录 + + + + + + 退出登录 + + + + + + 获取用户信息 + + + + + + diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application/Yi.BBS.Application.csproj b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application/Yi.BBS.Application.csproj new file mode 100644 index 00000000..4406865b --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application/Yi.BBS.Application.csproj @@ -0,0 +1,26 @@ + + + + net6.0 + enable + enable + True + ./ApplicationSwaggerDoc.xml + + + + + + + + + + + + + + Always + + + + diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application/YiBBSApplicationModule.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application/YiBBSApplicationModule.cs new file mode 100644 index 00000000..ade5109a --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application/YiBBSApplicationModule.cs @@ -0,0 +1,36 @@ +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; +using Yi.RBAC.Application; + +namespace Yi.BBS.Application +{ + [DependsOn( + + typeof(YiBBSApplicationContractsModule), + typeof(YiBBSDomainModule), + typeof(YiFrameworkAuthJwtBearerModule), + typeof(YiRBACApplicationModule) + )] + public class YiBBSApplicationModule : IStartupModule + { + public void Configure(IApplicationBuilder app, ConfigureMiddlewareContext context) + { + } + + public void ConfigureServices(IServiceCollection services, ConfigureServicesContext context) + { + } + } +} diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Domain.Shared/Yi.BBS.Domain.Shared.csproj b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Domain.Shared/Yi.BBS.Domain.Shared.csproj new file mode 100644 index 00000000..692994fe --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Domain.Shared/Yi.BBS.Domain.Shared.csproj @@ -0,0 +1,15 @@ + + + + net6.0 + enable + enable + + + + + + + + + diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Domain.Shared/YiBBSDomainSharedModule.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Domain.Shared/YiBBSDomainSharedModule.cs new file mode 100644 index 00000000..5f37e09e --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Domain.Shared/YiBBSDomainSharedModule.cs @@ -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) + { + } + } +} diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Domain/DomainSwaggerDoc.xml b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Domain/DomainSwaggerDoc.xml new file mode 100644 index 00000000..91f7886c --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Domain/DomainSwaggerDoc.xml @@ -0,0 +1,20 @@ + + + + Yi.BBS.Domain + + + + + 平铺自己 + + + + + + + 论坛模块的领域服务 + + + + diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Domain/Yi.BBS.Domain.csproj b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Domain/Yi.BBS.Domain.csproj new file mode 100644 index 00000000..77162d6c --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Domain/Yi.BBS.Domain.csproj @@ -0,0 +1,24 @@ + + + + net6.0 + enable + enable + True + ./DomainSwaggerDoc.xml + + + + + + + + + + + + Always + + + + diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Domain/YiBBSDomainModule.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Domain/YiBBSDomainModule.cs new file mode 100644 index 00000000..0ba04585 --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Domain/YiBBSDomainModule.cs @@ -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(); + } + } +} diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Sqlsugar/Yi.BBS.Sqlsugar.csproj b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Sqlsugar/Yi.BBS.Sqlsugar.csproj new file mode 100644 index 00000000..96d709be --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Sqlsugar/Yi.BBS.Sqlsugar.csproj @@ -0,0 +1,18 @@ + + + + net6.0 + enable + enable + + + + + + + + + + + + diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Sqlsugar/YiBBSSqlsugarModule.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Sqlsugar/YiBBSSqlsugarModule.cs new file mode 100644 index 00000000..83db7933 --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Sqlsugar/YiBBSSqlsugarModule.cs @@ -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.Core.Sqlsugar; +using Yi.BBS.Domain; +using Yi.RBAC.Sqlsugar; + +namespace Yi.BBS.Sqlsugar +{ + [DependsOn(typeof(YiFrameworkCoreSqlsugarModule), + typeof(YiBBSDomainModule), + typeof(YiRBACSqlsugarModule))] + public class YiBBSSqlsugarModule : IStartupModule + { + public void Configure(IApplicationBuilder app, ConfigureMiddlewareContext context) + { + } + + public void ConfigureServices(IServiceCollection services, ConfigureServicesContext context) + { + //services.AddTransient(); + } + } +} diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Web/Program.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Web/Program.cs new file mode 100644 index 00000000..5d0af2e6 --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Web/Program.cs @@ -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; +using Yi.BBS.Application; +using Yi.RBAC.Application; + +var builder = WebApplication.CreateBuilder(args); +builder.WebHost.UseStartUrlsServer(builder.Configuration); + +builder.UseYiModules(typeof(YiBBSWebModule)); + +builder.Host.ConfigureAutoFacContainer(container => +{ + container.RegisterYiModule(AutoFacModuleEnum.PropertiesAutowiredModule, + typeof(YiBBSApplicationModule).Assembly, + typeof(YiRBACApplicationModule).Assembly); +}); + +var app = builder.Build(); + +app.UseErrorHandlingServer(); + +app.UseAuthentication(); +app.UseAuthorization(); +app.MapControllers(); + +app.Run(); diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Web/Properties/launchSettings.json b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Web/Properties/launchSettings.json new file mode 100644 index 00000000..a6e70595 --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Web/Properties/launchSettings.json @@ -0,0 +1,15 @@ +{ + "$schema": "https://json.schemastore.org/launchsettings.json", + "profiles": { + "Yi.BBS.Web": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": false, + "launchUrl": "swagger", + "applicationUrl": "http://localhost:19003", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Web/Yi.BBS.Web.csproj b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Web/Yi.BBS.Web.csproj new file mode 100644 index 00000000..19d412ee --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Web/Yi.BBS.Web.csproj @@ -0,0 +1,27 @@ + + + + net6.0 + enable + enable + + + + + + + + + + + + + + Always + + + Always + + + + diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Web/YiBBSWebModule.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Web/YiBBSWebModule.cs new file mode 100644 index 00000000..2fbfc82f --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Web/YiBBSWebModule.cs @@ -0,0 +1,49 @@ +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; +using Yi.Framework.AspNetCore.Microsoft.Extensions.DependencyInjection; +using Yi.Framework.Core.Autofac; +using Yi.RBAC.Application; + +namespace Yi.BBS.Web +{ + [DependsOn( + typeof(YiFrameworkCoreAutofacModule), + 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); + opt.CreateConventional(typeof(YiRBACApplicationModule).Assembly, option => option.RootPath = string.Empty); + }); + + //添加swagger + services.AddSwaggerServer(); + } + public void Configure(IApplicationBuilder app, ConfigureMiddlewareContext context) + { + //if (app.Environment.IsDevelopment()) + { + app.UseSwaggerServer(); + } + + app.UseHttpsRedirection(); + + app.UseAuthorization(); + + app.UseRouting(); + } + } +} diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Web/appsettings.json b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Web/appsettings.json new file mode 100644 index 00000000..bf88b491 --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Web/appsettings.json @@ -0,0 +1,40 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*", + + //程序启动地址,*代表全部网口 + "StartUrl": "http://*:19003", + + //数据库类型列表 + "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 +} diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Web/key.pem b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Web/key.pem new file mode 100644 index 00000000..3314ab6e --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Web/key.pem @@ -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----- \ No newline at end of file diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Web/public.pem b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Web/public.pem new file mode 100644 index 00000000..1c9b622d --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Web/public.pem @@ -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----- \ No newline at end of file diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Web/yi-sqlsugar-dev.db b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Web/yi-sqlsugar-dev.db new file mode 100644 index 00000000..cdfebb08 Binary files /dev/null and b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Web/yi-sqlsugar-dev.db differ diff --git a/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Web/Program.cs b/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Web/Program.cs index 59be2aef..8fc3d552 100644 --- a/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Web/Program.cs +++ b/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Web/Program.cs @@ -2,6 +2,7 @@ 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.Application; using Yi.RBAC.Web; var builder = WebApplication.CreateBuilder(args); @@ -14,9 +15,8 @@ builder.UseYiModules(typeof(YiRBACWebModule)); //添加autofac模块,需要添加模块 builder.Host.ConfigureAutoFacContainer(container => { - container.RegisterYiModule(AutoFacModuleEnum.PropertiesAutowiredModule, typeof(YiRBACWebModule).Assembly); + container.RegisterYiModule(AutoFacModuleEnum.PropertiesAutowiredModule, typeof(YiRBACApplicationModule).Assembly); }); - var app = builder.Build(); //全局错误中间件,需要放在最早 diff --git a/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Web/YiRBACWebModule.cs b/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Web/YiRBACWebModule.cs index 1126eced..f93033d8 100644 --- a/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Web/YiRBACWebModule.cs +++ b/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Web/YiRBACWebModule.cs @@ -3,12 +3,14 @@ using StartupModules; using Yi.Framework.Auth.JwtBearer; using Yi.Framework.Core; using Yi.Framework.Core.Attributes; +using Yi.Framework.Core.Autofac; using Yi.RBAC.Application; using Yi.RBAC.Sqlsugar; namespace Yi.RBAC.Web { [DependsOn( + typeof(YiFrameworkCoreAutofacModule), typeof(YiRBACSqlsugarModule), typeof(YiRBACApplicationModule) )] diff --git a/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Web/yi-sqlsugar-dev.db b/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Web/yi-sqlsugar-dev.db index a53c9587..d6c7bf6b 100644 Binary files a/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Web/yi-sqlsugar-dev.db and b/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Web/yi-sqlsugar-dev.db differ diff --git a/Yi.Framework.Net6/src/project/template/GlobalUsings.cs b/Yi.Framework.Net6/src/project/template/GlobalUsings.cs new file mode 100644 index 00000000..71ceb406 --- /dev/null +++ b/Yi.Framework.Net6/src/project/template/GlobalUsings.cs @@ -0,0 +1,3 @@ +global using Yi.Framework.Core.Attributes; +global using Yi.Framework.Core.Helper; +global using Yi.Framework.Core.Model; \ No newline at end of file diff --git a/Yi.Framework.Net6/src/project/template/Yi.Template.Application.Contracts/ApplicationContractsSwaggerDoc.xml b/Yi.Framework.Net6/src/project/template/Yi.Template.Application.Contracts/ApplicationContractsSwaggerDoc.xml new file mode 100644 index 00000000..b9705a65 --- /dev/null +++ b/Yi.Framework.Net6/src/project/template/Yi.Template.Application.Contracts/ApplicationContractsSwaggerDoc.xml @@ -0,0 +1,18 @@ + + + + Yi.Template.Application.Contracts + + + + + Student输入创建对象 + + + + + Student + + + + diff --git a/Yi.Framework.Net6/src/project/Template/Yi.Template.Application.Contracts/School/Dtos/StudentCreateInputVo.cs b/Yi.Framework.Net6/src/project/template/Yi.Template.Application.Contracts/School/Dtos/Student/StudentCreateInputVo.cs similarity index 91% rename from Yi.Framework.Net6/src/project/Template/Yi.Template.Application.Contracts/School/Dtos/StudentCreateInputVo.cs rename to Yi.Framework.Net6/src/project/template/Yi.Template.Application.Contracts/School/Dtos/Student/StudentCreateInputVo.cs index 9744f3be..749e9f76 100644 --- a/Yi.Framework.Net6/src/project/Template/Yi.Template.Application.Contracts/School/Dtos/StudentCreateInputVo.cs +++ b/Yi.Framework.Net6/src/project/template/Yi.Template.Application.Contracts/School/Dtos/Student/StudentCreateInputVo.cs @@ -11,7 +11,6 @@ namespace Yi.Template.Application.Contracts.School.Dtos /// public class StudentCreateInputVo { - public long Id { get; set; } public string Name { get; set; } public int? Height { get; set; } public string? Phone { get; set; } diff --git a/Yi.Framework.Net6/src/project/Template/Yi.Template.Application.Contracts/School/Dtos/StudentGetListInputVo.cs b/Yi.Framework.Net6/src/project/template/Yi.Template.Application.Contracts/School/Dtos/Student/StudentGetListInputVo.cs similarity index 91% rename from Yi.Framework.Net6/src/project/Template/Yi.Template.Application.Contracts/School/Dtos/StudentGetListInputVo.cs rename to Yi.Framework.Net6/src/project/template/Yi.Template.Application.Contracts/School/Dtos/Student/StudentGetListInputVo.cs index 038080d6..2dc834cc 100644 --- a/Yi.Framework.Net6/src/project/Template/Yi.Template.Application.Contracts/School/Dtos/StudentGetListInputVo.cs +++ b/Yi.Framework.Net6/src/project/template/Yi.Template.Application.Contracts/School/Dtos/Student/StudentGetListInputVo.cs @@ -9,7 +9,6 @@ namespace Yi.Template.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; } diff --git a/Yi.Framework.Net6/src/project/Template/Yi.Template.Application.Contracts/School/Dtos/StudentGetListOutputDto.cs b/Yi.Framework.Net6/src/project/template/Yi.Template.Application.Contracts/School/Dtos/Student/StudentGetListOutputDto.cs similarity index 100% rename from Yi.Framework.Net6/src/project/Template/Yi.Template.Application.Contracts/School/Dtos/StudentGetListOutputDto.cs rename to Yi.Framework.Net6/src/project/template/Yi.Template.Application.Contracts/School/Dtos/Student/StudentGetListOutputDto.cs diff --git a/Yi.Framework.Net6/src/project/template/Yi.Template.Application.Contracts/School/Dtos/Student/StudentGetOutputDto.cs b/Yi.Framework.Net6/src/project/template/Yi.Template.Application.Contracts/School/Dtos/Student/StudentGetOutputDto.cs new file mode 100644 index 00000000..22afda93 --- /dev/null +++ b/Yi.Framework.Net6/src/project/template/Yi.Template.Application.Contracts/School/Dtos/Student/StudentGetOutputDto.cs @@ -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.Template.Application.Contracts.School.Dtos +{ + public class StudentGetOutputDto : IEntityDto + { + public long Id { get; set; } + public string Name { get; set; } + public int? Height { get; set; } + public string? Phone { get; set; } + } +} diff --git a/Yi.Framework.Net6/src/project/Template/Yi.Template.Application.Contracts/School/Dtos/StudentUpdateInputVo.cs b/Yi.Framework.Net6/src/project/template/Yi.Template.Application.Contracts/School/Dtos/Student/StudentUpdateInputVo.cs similarity index 90% rename from Yi.Framework.Net6/src/project/Template/Yi.Template.Application.Contracts/School/Dtos/StudentUpdateInputVo.cs rename to Yi.Framework.Net6/src/project/template/Yi.Template.Application.Contracts/School/Dtos/Student/StudentUpdateInputVo.cs index 38ec5cf3..4121fbb6 100644 --- a/Yi.Framework.Net6/src/project/Template/Yi.Template.Application.Contracts/School/Dtos/StudentUpdateInputVo.cs +++ b/Yi.Framework.Net6/src/project/template/Yi.Template.Application.Contracts/School/Dtos/Student/StudentUpdateInputVo.cs @@ -8,7 +8,6 @@ namespace Yi.Template.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; } diff --git a/Yi.Framework.Net6/src/project/template/Yi.Template.Application.Contracts/School/IStudentService.cs b/Yi.Framework.Net6/src/project/template/Yi.Template.Application.Contracts/School/IStudentService.cs new file mode 100644 index 00000000..a721c5e3 --- /dev/null +++ b/Yi.Framework.Net6/src/project/template/Yi.Template.Application.Contracts/School/IStudentService.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Yi.Template.Application.Contracts.School.Dtos; +using Yi.Framework.Ddd.Services.Abstract; + +namespace Yi.Template.Application.Contracts.School +{ + /// + /// Student + /// + public interface IStudentService : ICrudAppService + { + + } +} diff --git a/Yi.Framework.Net6/src/project/template/Yi.Template.Application.Contracts/Yi.Template.Application.Contracts.csproj b/Yi.Framework.Net6/src/project/template/Yi.Template.Application.Contracts/Yi.Template.Application.Contracts.csproj new file mode 100644 index 00000000..ea141dde --- /dev/null +++ b/Yi.Framework.Net6/src/project/template/Yi.Template.Application.Contracts/Yi.Template.Application.Contracts.csproj @@ -0,0 +1,23 @@ + + + + net6.0 + enable + enable + True + ./ApplicationContractsSwaggerDoc.xml + + + + + + + + + + + Always + + + + diff --git a/Yi.Framework.Net6/src/project/template/Yi.Template.Application.Contracts/YiTemplateApplicationContractsModule.cs b/Yi.Framework.Net6/src/project/template/Yi.Template.Application.Contracts/YiTemplateApplicationContractsModule.cs new file mode 100644 index 00000000..d2ea5d76 --- /dev/null +++ b/Yi.Framework.Net6/src/project/template/Yi.Template.Application.Contracts/YiTemplateApplicationContractsModule.cs @@ -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.Template.Domain.Shared; + +namespace Yi.Template.Application.Contracts +{ + [DependsOn( + typeof(YiTemplateDomainSharedModule) + )] + public class YiTemplateApplicationContractsModule : IStartupModule + { + public void Configure(IApplicationBuilder app, ConfigureMiddlewareContext context) + { + } + + public void ConfigureServices(IServiceCollection services, ConfigureServicesContext context) + { + } + } +} diff --git a/Yi.Framework.Net6/src/project/template/Yi.Template.Application/ApplicationSwaggerDoc.xml b/Yi.Framework.Net6/src/project/template/Yi.Template.Application/ApplicationSwaggerDoc.xml new file mode 100644 index 00000000..da7b20a5 --- /dev/null +++ b/Yi.Framework.Net6/src/project/template/Yi.Template.Application/ApplicationSwaggerDoc.xml @@ -0,0 +1,13 @@ + + + + Yi.Template.Application + + + + + Student服务实现 + + + + diff --git a/Yi.Framework.Net6/src/project/template/Yi.Template.Application/School/MapperConfig/StudentProfile.cs b/Yi.Framework.Net6/src/project/template/Yi.Template.Application/School/MapperConfig/StudentProfile.cs new file mode 100644 index 00000000..bcea70dd --- /dev/null +++ b/Yi.Framework.Net6/src/project/template/Yi.Template.Application/School/MapperConfig/StudentProfile.cs @@ -0,0 +1,23 @@ +using AutoMapper; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Yi.Template.Application.Contracts.School.Dtos; +using Yi.Template.Domain.School.Entities; + +namespace Yi.Template.Application.School.MapperConfig +{ + public class StudentProfile: Profile + { + public StudentProfile() + { + CreateMap(); + CreateMap(); + CreateMap(); + CreateMap(); + CreateMap(); + } + } +} diff --git a/Yi.Framework.Net6/src/project/template/Yi.Template.Application/School/StudentService.cs b/Yi.Framework.Net6/src/project/template/Yi.Template.Application/School/StudentService.cs new file mode 100644 index 00000000..1d851255 --- /dev/null +++ b/Yi.Framework.Net6/src/project/template/Yi.Template.Application/School/StudentService.cs @@ -0,0 +1,17 @@ +using Yi.Template.Application.Contracts.School; +using NET.AutoWebApi.Setting; +using Yi.Template.Application.Contracts.School.Dtos; +using Yi.Template.Domain.School.Entities; +using Yi.Framework.Ddd.Services; + +namespace Yi.Template.Application.School +{ + /// + /// Student服务实现 + /// + [AppService] + public class StudentService : CrudAppService, + IStudentService, IAutoApiService + { + } +} diff --git a/Yi.Framework.Net6/src/project/template/Yi.Template.Application/Yi.Template.Application.csproj b/Yi.Framework.Net6/src/project/template/Yi.Template.Application/Yi.Template.Application.csproj new file mode 100644 index 00000000..0a5bab98 --- /dev/null +++ b/Yi.Framework.Net6/src/project/template/Yi.Template.Application/Yi.Template.Application.csproj @@ -0,0 +1,25 @@ + + + + net6.0 + enable + enable + True + ./ApplicationSwaggerDoc.xml + + + + + + + + + + + + + Always + + + + diff --git a/Yi.Framework.Net6/src/project/template/Yi.Template.Application/YiTemplateApplicationModule.cs b/Yi.Framework.Net6/src/project/template/Yi.Template.Application/YiTemplateApplicationModule.cs new file mode 100644 index 00000000..c58eb473 --- /dev/null +++ b/Yi.Framework.Net6/src/project/template/Yi.Template.Application/YiTemplateApplicationModule.cs @@ -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.Template.Application.Contracts; +using Yi.Framework.Auth.JwtBearer; +using Yi.Framework.Core.Attributes; +using Yi.Framework.Data; +using Yi.Framework.Ddd; +using Yi.Template.Domain; + +namespace Yi.Template.Application +{ + [DependsOn( + typeof(YiTemplateApplicationContractsModule), + typeof(YiTemplateDomainModule), + typeof(YiFrameworkAuthJwtBearerModule) + )] + public class YiTemplateApplicationModule : IStartupModule + { + public void Configure(IApplicationBuilder app, ConfigureMiddlewareContext context) + { + } + + public void ConfigureServices(IServiceCollection services, ConfigureServicesContext context) + { + } + } +} diff --git a/Yi.Framework.Net6/src/project/template/Yi.Template.Domain.Shared/School/ConstClasses/StudentConst.cs b/Yi.Framework.Net6/src/project/template/Yi.Template.Domain.Shared/School/ConstClasses/StudentConst.cs new file mode 100644 index 00000000..f22c18ed --- /dev/null +++ b/Yi.Framework.Net6/src/project/template/Yi.Template.Domain.Shared/School/ConstClasses/StudentConst.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Yi.Template.Domain.Shared.School.ConstClasses +{ + /// + /// 常量定义 + /// + + public class StudentConst + { + } +} diff --git a/Yi.Framework.Net6/src/project/template/Yi.Template.Domain.Shared/Yi.Template.Domain.Shared.csproj b/Yi.Framework.Net6/src/project/template/Yi.Template.Domain.Shared/Yi.Template.Domain.Shared.csproj new file mode 100644 index 00000000..692994fe --- /dev/null +++ b/Yi.Framework.Net6/src/project/template/Yi.Template.Domain.Shared/Yi.Template.Domain.Shared.csproj @@ -0,0 +1,15 @@ + + + + net6.0 + enable + enable + + + + + + + + + diff --git a/Yi.Framework.Net6/src/project/template/Yi.Template.Domain.Shared/YiTemplateDomainSharedModule.cs b/Yi.Framework.Net6/src/project/template/Yi.Template.Domain.Shared/YiTemplateDomainSharedModule.cs new file mode 100644 index 00000000..4e14cee3 --- /dev/null +++ b/Yi.Framework.Net6/src/project/template/Yi.Template.Domain.Shared/YiTemplateDomainSharedModule.cs @@ -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.Template.Domain.Shared +{ + [DependsOn( + typeof(YiFrameworkDddModule) + )] + public class YiTemplateDomainSharedModule : IStartupModule + { + public void Configure(IApplicationBuilder app, ConfigureMiddlewareContext context) + { + } + + public void ConfigureServices(IServiceCollection services, ConfigureServicesContext context) + { + } + } +} diff --git a/Yi.Framework.Net6/src/project/template/Yi.Template.Domain/DomainSwaggerDoc.xml b/Yi.Framework.Net6/src/project/template/Yi.Template.Domain/DomainSwaggerDoc.xml new file mode 100644 index 00000000..01f6d524 --- /dev/null +++ b/Yi.Framework.Net6/src/project/template/Yi.Template.Domain/DomainSwaggerDoc.xml @@ -0,0 +1,8 @@ + + + + Yi.Template.Domain + + + + diff --git a/Yi.Framework.Net6/src/project/template/Yi.Template.Domain/School/DataSeeds/StudentDataSeed.cs b/Yi.Framework.Net6/src/project/template/Yi.Template.Domain/School/DataSeeds/StudentDataSeed.cs new file mode 100644 index 00000000..bb3092b9 --- /dev/null +++ b/Yi.Framework.Net6/src/project/template/Yi.Template.Domain/School/DataSeeds/StudentDataSeed.cs @@ -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.Template.Domain.School.Entities; + +namespace Yi.Template.Domain.School.DataSeeds +{ + [AppService(typeof(IDataSeed))] + public class StudentDataSeed : AbstractDataSeed + { + public StudentDataSeed(IRepository repository) : base(repository) + { + } + + public override List GetSeedData() + { + return new List() { 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 } + }; + } + } +} diff --git a/Yi.Framework.Net6/src/project/template/Yi.Template.Domain/School/Entities/StudentEntity.cs b/Yi.Framework.Net6/src/project/template/Yi.Template.Domain/School/Entities/StudentEntity.cs new file mode 100644 index 00000000..61245c3e --- /dev/null +++ b/Yi.Framework.Net6/src/project/template/Yi.Template.Domain/School/Entities/StudentEntity.cs @@ -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.Template.Domain.School.Entities +{ + [SugarTable("Student")] + public class StudentEntity : IEntity,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; + } +} diff --git a/Yi.Framework.Net6/src/project/template/Yi.Template.Domain/Yi.Template.Domain.csproj b/Yi.Framework.Net6/src/project/template/Yi.Template.Domain/Yi.Template.Domain.csproj new file mode 100644 index 00000000..71936c72 --- /dev/null +++ b/Yi.Framework.Net6/src/project/template/Yi.Template.Domain/Yi.Template.Domain.csproj @@ -0,0 +1,24 @@ + + + + net6.0 + enable + enable + True + ./DomainSwaggerDoc.xml + + + + + + + + + + + + Always + + + + diff --git a/Yi.Framework.Net6/src/project/template/Yi.Template.Domain/YiTemplateDomainModule.cs b/Yi.Framework.Net6/src/project/template/Yi.Template.Domain/YiTemplateDomainModule.cs new file mode 100644 index 00000000..e94138cd --- /dev/null +++ b/Yi.Framework.Net6/src/project/template/Yi.Template.Domain/YiTemplateDomainModule.cs @@ -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.Template.Domain.Shared; + +namespace Yi.Template.Domain +{ + [DependsOn( + typeof(YiTemplateDomainSharedModule), + typeof(YiFrameworkDataModule) + )] + public class YiTemplateDomainModule : IStartupModule + { + public void Configure(IApplicationBuilder app, ConfigureMiddlewareContext context) + { + } + + public void ConfigureServices(IServiceCollection services, ConfigureServicesContext context) + { + //services.AddTransient(); + } + } +} diff --git a/Yi.Framework.Net6/src/project/template/Yi.Template.Sqlsugar/Yi.Template.Sqlsugar.csproj b/Yi.Framework.Net6/src/project/template/Yi.Template.Sqlsugar/Yi.Template.Sqlsugar.csproj new file mode 100644 index 00000000..8f842da8 --- /dev/null +++ b/Yi.Framework.Net6/src/project/template/Yi.Template.Sqlsugar/Yi.Template.Sqlsugar.csproj @@ -0,0 +1,17 @@ + + + + net6.0 + enable + enable + + + + + + + + + + + diff --git a/Yi.Framework.Net6/src/project/template/Yi.Template.Sqlsugar/YiTemplateSqlsugarModule.cs b/Yi.Framework.Net6/src/project/template/Yi.Template.Sqlsugar/YiTemplateSqlsugarModule.cs new file mode 100644 index 00000000..6176073a --- /dev/null +++ b/Yi.Framework.Net6/src/project/template/Yi.Template.Sqlsugar/YiTemplateSqlsugarModule.cs @@ -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.Template.Domain; + +namespace Yi.Template.Sqlsugar +{ + [DependsOn(typeof(YiFrameworkCoreSqlsugarModule), + typeof(YiTemplateDomainModule))] + public class YiTemplateSqlsugarModule : IStartupModule + { + public void Configure(IApplicationBuilder app, ConfigureMiddlewareContext context) + { + } + + public void ConfigureServices(IServiceCollection services, ConfigureServicesContext context) + { + //services.AddTransient(); + } + } +} diff --git a/Yi.Framework.Net6/src/project/template/Yi.Template.Web/Program.cs b/Yi.Framework.Net6/src/project/template/Yi.Template.Web/Program.cs new file mode 100644 index 00000000..be0db32c --- /dev/null +++ b/Yi.Framework.Net6/src/project/template/Yi.Template.Web/Program.cs @@ -0,0 +1,30 @@ +using AspNetCore.Microsoft.AspNetCore.Hosting; +using Yi.Framework.Core.Autofac.Extensions; +using Yi.Framework.Core.Autofac.Modules; +using Yi.Framework.Core.Extensions; +using Yi.Template.Application; +using Yi.Template.Web; + +var builder = WebApplication.CreateBuilder(args); +//设置启动url +builder.WebHost.UseStartUrlsServer(builder.Configuration); + +//添加模块 +builder.UseYiModules(typeof(YiTemplateWebModule)); + +//添加autofac模块,需要添加模块 +builder.Host.ConfigureAutoFacContainer(container => +{ + container.RegisterYiModule(AutoFacModuleEnum.PropertiesAutowiredModule, typeof(YiTemplateApplicationModule).Assembly); +}); + +var app = builder.Build(); + +//全局错误中间件,需要放在最早 +app.UseErrorHandlingServer(); + +app.UseAuthentication(); +app.UseAuthorization(); +app.MapControllers(); + +app.Run(); diff --git a/Yi.Framework.Net6/src/project/template/Yi.Template.Web/Properties/launchSettings.json b/Yi.Framework.Net6/src/project/template/Yi.Template.Web/Properties/launchSettings.json new file mode 100644 index 00000000..1384d89f --- /dev/null +++ b/Yi.Framework.Net6/src/project/template/Yi.Template.Web/Properties/launchSettings.json @@ -0,0 +1,15 @@ +{ + "$schema": "https://json.schemastore.org/launchsettings.json", + "profiles": { + "Yi.Template.Web": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "launchUrl": "swagger", + "applicationUrl": "http://localhost:19002", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/Yi.Framework.Net6/src/project/template/Yi.Template.Web/Yi.Template.Web.csproj b/Yi.Framework.Net6/src/project/template/Yi.Template.Web/Yi.Template.Web.csproj new file mode 100644 index 00000000..6831173d --- /dev/null +++ b/Yi.Framework.Net6/src/project/template/Yi.Template.Web/Yi.Template.Web.csproj @@ -0,0 +1,27 @@ + + + + net6.0 + enable + enable + + + + + + + + + + + + + + Always + + + Always + + + + diff --git a/Yi.Framework.Net6/src/project/template/Yi.Template.Web/YiTemplateWebModule.cs b/Yi.Framework.Net6/src/project/template/Yi.Template.Web/YiTemplateWebModule.cs new file mode 100644 index 00000000..c7623b63 --- /dev/null +++ b/Yi.Framework.Net6/src/project/template/Yi.Template.Web/YiTemplateWebModule.cs @@ -0,0 +1,46 @@ +using AspNetCore.Microsoft.AspNetCore.Builder; +using StartupModules; +using Yi.Framework.Auth.JwtBearer; +using Yi.Framework.Core; +using Yi.Framework.Core.Attributes; +using Yi.Framework.Core.Autofac; +using Yi.Template.Application; +using Yi.Template.Sqlsugar; + +namespace Yi.Template.Web +{ + [DependsOn( + typeof(YiFrameworkCoreAutofacModule), + typeof(YiTemplateSqlsugarModule), + typeof(YiTemplateApplicationModule) + )] + public class YiTemplateWebModule : IStartupModule + { + public void ConfigureServices(IServiceCollection services, ConfigureServicesContext context) + { + //添加控制器与动态api + services.AddControllers(); + services.AddAutoApiService(opt => + { + //NETServiceTest所在程序集添加进动态api配置 + opt.CreateConventional(typeof(YiTemplateApplicationModule).Assembly, option => option.RootPath = string.Empty); + }); + + //添加swagger + services.AddSwaggerServer(); + } + public void Configure(IApplicationBuilder app, ConfigureMiddlewareContext context) + { + //if (app.Environment.IsDevelopment()) + { + app.UseSwaggerServer(); + } + + app.UseHttpsRedirection(); + + app.UseAuthorization(); + + app.UseRouting(); + } + } +} diff --git a/Yi.Framework.Net6/src/project/template/Yi.Template.Web/appsettings.json b/Yi.Framework.Net6/src/project/template/Yi.Template.Web/appsettings.json new file mode 100644 index 00000000..35a27b42 --- /dev/null +++ b/Yi.Framework.Net6/src/project/template/Yi.Template.Web/appsettings.json @@ -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 +} diff --git a/Yi.Framework.Net6/src/project/template/Yi.Template.Web/key.pem b/Yi.Framework.Net6/src/project/template/Yi.Template.Web/key.pem new file mode 100644 index 00000000..3314ab6e --- /dev/null +++ b/Yi.Framework.Net6/src/project/template/Yi.Template.Web/key.pem @@ -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----- \ No newline at end of file diff --git a/Yi.Framework.Net6/src/project/template/Yi.Template.Web/public.pem b/Yi.Framework.Net6/src/project/template/Yi.Template.Web/public.pem new file mode 100644 index 00000000..1c9b622d --- /dev/null +++ b/Yi.Framework.Net6/src/project/template/Yi.Template.Web/public.pem @@ -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----- \ No newline at end of file diff --git a/Yi.Framework.Net6/src/project/template/Yi.Template.Web/yi-sqlsugar-dev.db b/Yi.Framework.Net6/src/project/template/Yi.Template.Web/yi-sqlsugar-dev.db new file mode 100644 index 00000000..a53c9587 Binary files /dev/null and b/Yi.Framework.Net6/src/project/template/Yi.Template.Web/yi-sqlsugar-dev.db differ