添加模块规则

This commit is contained in:
陈淳
2023-01-12 14:58:16 +08:00
parent ba84d0ead3
commit 7706126479
34 changed files with 293 additions and 134 deletions

View File

@@ -1,7 +0,0 @@
namespace Yi.Framework.Application.Contracts
{
public class Class1
{
}
}

View File

@@ -1,12 +0,0 @@
{
"profiles": {
"Yi.Framework.Application.Contracts": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:53034;http://localhost:53037"
}
}
}

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.Domain.Shared.Student.IRepository;
namespace Yi.Framework.Application.Contracts.Student
{
/// <summary>
/// 服务抽象
/// </summary>
public interface IStudentService
{
}
}

View File

@@ -6,4 +6,12 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<Folder Include="Student\Dtos\" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Yi.Framework.Domain.Shared\Yi.Framework.Domain.Shared.csproj" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,22 @@
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;
namespace Yi.Framework.Application.Contracts
{
public class YiFrameworkApplicationContractsModule : IStartupModule
{
public void Configure(IApplicationBuilder app, ConfigureMiddlewareContext context)
{
}
public void ConfigureServices(IServiceCollection services, ConfigureServicesContext context)
{
}
}
}

View File

@@ -1,12 +0,0 @@
{
"profiles": {
"Yi.Framework.Application": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:53032;http://localhost:53036"
}
}
}

View File

@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Framework.Application.Student.MapperConfig
{
internal class StudentProfile
{
}
}

View File

@@ -0,0 +1,32 @@
using Panda.DynamicWebApi;
using Panda.DynamicWebApi.Attributes;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Yi.Framework.Application.Contracts.Student;
using Yi.Framework.Domain.Shared.Student.IRepository;
using Yi.Framework.Domain.Student;
namespace Yi.Framework.Application.Student
{
/// <summary>
/// 服务实现
/// </summary>
[DynamicWebApi]
public class StudentService : IStudentService, IDynamicWebApi
{
private readonly IStudentRepository _studentRepository;
private readonly StudentManager _studentManager;
public StudentService(IStudentRepository studentRepository, StudentManager studentManager )
{
_studentRepository = studentRepository;
_studentManager = studentManager;
}
public string GetShijie()
{
return "你好世界";
}
}
}

View File

@@ -4,5 +4,10 @@
<name>Yi.Framework.Application</name>
</assembly>
<members>
<member name="T:Yi.Framework.Application.Student.StudentService">
<summary>
服务实现
</summary>
</member>
</members>
</doc>

View File

@@ -1,15 +0,0 @@
using Microsoft.AspNetCore.Mvc;
using Panda.DynamicWebApi;
using Panda.DynamicWebApi.Attributes;
namespace Yi.Framework.Application
{
[DynamicWebApi]
public class TestService : IDynamicWebApi
{
public string GetShijie()
{
return "你好世界";
}
}
}

View File

@@ -9,7 +9,9 @@
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Yi.Framework.Core\Yi.Framework.Core.csproj" />
<ProjectReference Include="..\Yi.Framework.Application.Contracts\Yi.Framework.Application.Contracts.csproj" />
<ProjectReference Include="..\Yi.Framework.Core.AutoMapper\Yi.Framework.Core.AutoMapper.csproj" />
<ProjectReference Include="..\Yi.Framework.Domain\Yi.Framework.Domain.csproj" />
</ItemGroup>
<ItemGroup>

View File

@@ -6,6 +6,8 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Yi.Framework.Application.Contracts.Student;
using Yi.Framework.Application.Student;
namespace Yi.Framework.Application
{
@@ -18,7 +20,7 @@ namespace Yi.Framework.Application
public void ConfigureServices(IServiceCollection services, ConfigureServicesContext context)
{
services.AddTransient<IStudentService, StudentService>();
}
}
}

View File

@@ -98,7 +98,7 @@ namespace Yi.Framework.Caching.Redis
/// </summary>
/// <param name="channels"></param>
/// <returns></returns>
public override SubscribeObject Subscribe(params (string, Action<SubscribeMessageEventArgs>)[] channels)
public SubscribeObject Subscribe(params (string, Action<SubscribeMessageEventArgs>)[] channels)
{
return _client.Subscribe(channels);
}
@@ -109,7 +109,7 @@ namespace Yi.Framework.Caching.Redis
/// <param name="listKey"></param>
/// <param name="onMessage"></param>
/// <returns></returns>
public override SubscribeListObject SubscribeList(string listKey, Action<string> onMessage)
public SubscribeListObject SubscribeList(string listKey, Action<string> onMessage)
{
return _client.SubscribeList(listKey, onMessage);
}
@@ -121,7 +121,7 @@ namespace Yi.Framework.Caching.Redis
/// <param name="clientId"></param>
/// <param name="onMessage"></param>
/// <returns></returns>
public override SubscribeListBroadcastObject SubscribeListBroadcast(string listKey, string clientId, Action<string> onMessage)
public SubscribeListBroadcastObject SubscribeListBroadcast(string listKey, string clientId, Action<string> onMessage)
{
return _client.SubscribeListBroadcast(listKey, clientId, onMessage);
}

View File

@@ -51,10 +51,10 @@ namespace Yi.Framework.Core.Extensions
var claims = authenticateContext.Principal.Claims;
//通过鉴权之后,开始赋值
_currentUser.IsAuthenticated = true;
_currentUser.Id = claims.GetClaim(JwtRegisteredClaimNames.Sid) is null ? 0 : Convert.ToInt64(claims.GetClaim(JwtRegisteredClaimNames.Sid));
_currentUser.UserName = claims.GetClaim(SystemConst.UserName) ?? "";
_currentUser.Permission = claims.GetClaims(SystemConst.PermissionClaim);
_currentUser.TenantId = claims.GetClaim(SystemConst.TenantId) is null ? null : Guid.Parse(claims.GetClaim(SystemConst.TenantId)!);
//_currentUser.Id = claims.GetClaim(JwtRegisteredClaimNames.Sid) is null ? 0 : Convert.ToInt64(claims.GetClaim(JwtRegisteredClaimNames.Sid));
//_currentUser.UserName = claims.GetClaim(SystemConst.UserName) ?? "";
//_currentUser.Permission = claims.GetClaims(SystemConst.PermissionClaim);
//_currentUser.TenantId = claims.GetClaim(SystemConst.TenantId) is null ? null : Guid.Parse(claims.GetClaim(SystemConst.TenantId)!);
await _next(context);
}

View File

@@ -1,7 +0,0 @@
namespace Yi.Framework.Domain.Shared
{
public class Class1
{
}
}

View File

@@ -1,12 +0,0 @@
{
"profiles": {
"Yi.Framework.Domain.Shared": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:53033;http://localhost:53038"
}
}
}

View File

@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Framework.Domain.Shared.Student.ConstClasses
{
/// <summary>
/// 常量定义
/// </summary>
public class StudentConst
{
public const string = "失败!学生已经重复";
}
}

View File

@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Framework.Domain.Shared.Student.IRepository
{
/// <summary>
/// 仓储抽象
/// </summary>
public interface IStudentRepository
{
}
}

View File

@@ -6,4 +6,8 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Yi.Framework.Ddd.Application\Yi.Framework.Ddd.csproj" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,22 @@
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;
namespace Yi.Framework.Domain.Shared
{
public class YiFrameworkDomainSharedModule : IStartupModule
{
public void Configure(IApplicationBuilder app, ConfigureMiddlewareContext context)
{
}
public void ConfigureServices(IServiceCollection services, ConfigureServicesContext context)
{
}
}
}

View File

@@ -1,7 +0,0 @@
namespace Yi.Framework.Domain
{
public class Class1
{
}
}

View File

@@ -1,12 +0,0 @@
{
"profiles": {
"Yi.Framework.Domain": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:53035;http://localhost:53040"
}
}
}

View File

@@ -0,0 +1,19 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Framework.Domain.Student.Entities
{
/// <summary>
/// 实体
/// </summary>
[SugarTable("Student")]
public class StudentEntity
{
public long Id { get; set; }
public string Name { get; set; } = string.Empty;
}
}

View File

@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Yi.Framework.Domain.Shared.Student.IRepository;
namespace Yi.Framework.Domain.Student
{
/// <summary>
/// 领域服务
/// </summary>
public class StudentManager
{
private readonly IStudentRepository _studentRepository;
public StudentManager(IStudentRepository studentRepository)
{
_studentRepository=studentRepository;
}
}
}

View File

@@ -6,4 +6,9 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Yi.Framework.Domain.Shared\Yi.Framework.Domain.Shared.csproj" />
<ProjectReference Include="..\Yi.Framework.Sqlsugar\Yi.Framework.Sqlsugar.csproj" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,24 @@
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.Domain.Student;
namespace Yi.Framework.Domain
{
public class YiFrameworkDomainModule : IStartupModule
{
public void Configure(IApplicationBuilder app, ConfigureMiddlewareContext context)
{
}
public void ConfigureServices(IServiceCollection services, ConfigureServicesContext context)
{
services.AddTransient<StudentManager>();
}
}
}

View File

@@ -1,7 +0,0 @@
namespace Yi.Framework.Sqlsugar
{
public class Class1
{
}
}

View File

@@ -1,12 +0,0 @@
{
"profiles": {
"Yi.Framework.Sqlsugar": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:53031;http://localhost:53039"
}
}
}

View File

@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Yi.Framework.Domain.Shared.Student.IRepository;
namespace Yi.Framework.Sqlsugar.Student
{
/// <summary>
/// 仓储实现方式
/// </summary>
public class StudentRepository: IStudentRepository
{
}
}

View File

@@ -6,4 +6,9 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Yi.Framework.Core.Sqlsugar\Yi.Framework.Core.Sqlsugar.csproj" />
<ProjectReference Include="..\Yi.Framework.Domain.Shared\Yi.Framework.Domain.Shared.csproj" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,25 @@
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.Domain.Shared.Student.IRepository;
using Yi.Framework.Sqlsugar.Student;
namespace Yi.Framework.Sqlsugar
{
public class YiFrameworkSqlsugarModule : IStartupModule
{
public void Configure(IApplicationBuilder app, ConfigureMiddlewareContext context)
{
}
public void ConfigureServices(IServiceCollection services, ConfigureServicesContext context)
{
services.AddTransient<IStudentRepository, StudentRepository>();
}
}
}

View File

@@ -3,6 +3,7 @@ using AspNetCore.Microsoft.AspNetCore.Builder;
using Panda.DynamicWebApi;
using System.Reflection;
using Yi.Framework.Application;
using Yi.Framework.Application.Contracts;
using Yi.Framework.Autofac.Extensions;
using Yi.Framework.Core;
using Yi.Framework.Core.AutoMapper;
@@ -11,6 +12,9 @@ using Yi.Framework.Core.Sqlsugar;
using Yi.Framework.Core.Sqlsugar.Repository;
using Yi.Framework.Ddd;
using Yi.Framework.Ddd.Repository;
using Yi.Framework.Domain;
using Yi.Framework.Domain.Shared;
using Yi.Framework.Sqlsugar;
using Yi.Framework.Web;
var builder = WebApplication.CreateBuilder(args);
@@ -22,7 +26,13 @@ builder.UseYiModules(
typeof(YiFrameworkCoreModule).Assembly,
typeof(YiFrameworkCoreAutoMapperModule).Assembly,
typeof(YiFrameworkDddModule).Assembly,
typeof(YiFrameworkCoreSqlsugarModule).Assembly
typeof(YiFrameworkCoreSqlsugarModule).Assembly,
typeof(YiFrameworkSqlsugarModule).Assembly,
typeof(YiFrameworkDomainSharedModule).Assembly,
typeof(YiFrameworkDomainModule).Assembly,
typeof(YiFrameworkApplicationContractsModule).Assembly,
typeof(YiFrameworkApplicationModule).Assembly
);
//ʹ<><CAB9>autofac

View File

@@ -1,28 +1,12 @@
{
"$schema": "https://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:56921",
"sslPort": 44346
}
},
"profiles": {
"Yi.Framework.Web": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "swagger",
"applicationUrl": "https://localhost:7253;http://localhost:5109",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "swagger",
"applicationUrl": "http://localhost:19002",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}

View File

@@ -8,11 +8,7 @@
<ItemGroup>
<ProjectReference Include="..\Yi.Framework.Application\Yi.Framework.Application.csproj" />
<ProjectReference Include="..\Yi.Framework.AspNetCore\Yi.Framework.AspNetCore.csproj" />
<ProjectReference Include="..\Yi.Framework.Core.Autofac\Yi.Framework.Core.Autofac.csproj" />
<ProjectReference Include="..\Yi.Framework.Core.AutoMapper\Yi.Framework.Core.AutoMapper.csproj" />
<ProjectReference Include="..\Yi.Framework.Core.Sqlsugar\Yi.Framework.Core.Sqlsugar.csproj" />
<ProjectReference Include="..\Yi.Framework.Core\Yi.Framework.Core.csproj" />
</ItemGroup>
</Project>