diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Config/SwaggerDoc.xml b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Config/SwaggerDoc.xml index bb267175..655c8090 100644 --- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Config/SwaggerDoc.xml +++ b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Config/SwaggerDoc.xml @@ -719,7 +719,6 @@ - diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/StudentController.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/StudentController.cs index f98c18ba..dd351468 100644 --- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/StudentController.cs +++ b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/StudentController.cs @@ -57,7 +57,6 @@ namespace Brick.IFServer.Controllers /// /// /// - /// /// [HttpGet] public async Task>> GetLsit() diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/yi-sqlsugar-dev.db b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/yi-sqlsugar-dev.db index ee93ef51..24c8ecac 100644 Binary files a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/yi-sqlsugar-dev.db and b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/yi-sqlsugar-dev.db differ diff --git a/Yi.Framework.Net6/Yi.Framework.Common/Helper/AssemblyHelper.cs b/Yi.Framework.Net6/Yi.Framework.Common/Helper/AssemblyHelper.cs index ac95e268..c74ef1ff 100644 --- a/Yi.Framework.Net6/Yi.Framework.Common/Helper/AssemblyHelper.cs +++ b/Yi.Framework.Net6/Yi.Framework.Common/Helper/AssemblyHelper.cs @@ -1,4 +1,6 @@ -using System; +using AutoMapper; +using AutoMapper.Internal; +using System; using System.Collections.Generic; using System.Linq; using System.Reflection; @@ -9,14 +11,32 @@ namespace Yi.Framework.Common.Helper { public class AssemblyHelper { - public static List GetClass(string assemblyFile, string className = null, string spaceName=null) + public static List GetClass(string assemblyFile, string className = null, string spaceName = null) { Assembly assembly = Assembly.Load(assemblyFile); - return assembly.GetTypes().Where(m => m.IsClass - && className == null?true:m.Name==className - && spaceName == null ? true :m.Namespace == spaceName + return assembly.GetTypes().Where(m => m.IsClass + && className == null ? true : m.Name == className + && spaceName == null ? true : m.Namespace == spaceName ).ToList(); } + public static List GetClassByBaseClassesAndInterfaces(string assemblyFile, Type type) + { + Assembly assembly = Assembly.Load(assemblyFile); + + List resList = new List(); + + List typeList = assembly.GetTypes().Where(m => m.IsClass).ToList(); + foreach (var t in typeList) + { + var data = t.BaseClassesAndInterfaces(); + if (data.Contains(type)) + { + resList.Add(t); + } + + } + return resList; + } } -} +} \ No newline at end of file diff --git a/Yi.Framework.Net6/Yi.Framework.Service/Base/Crud/AbstractKeyCrudAppService.cs b/Yi.Framework.Net6/Yi.Framework.Service/Base/Crud/AbstractKeyCrudAppService.cs index 429e74b4..00f1585d 100644 --- a/Yi.Framework.Net6/Yi.Framework.Service/Base/Crud/AbstractKeyCrudAppService.cs +++ b/Yi.Framework.Net6/Yi.Framework.Service/Base/Crud/AbstractKeyCrudAppService.cs @@ -80,7 +80,7 @@ namespace Yi.Framework.Service.Base.Crud /// /// /// - public virtual async Task DeleteAsync(IEnumerable ids) + public virtual Task DeleteAsync(IEnumerable ids) { throw new NotImplementedException(); } @@ -110,9 +110,9 @@ namespace Yi.Framework.Service.Base.Crud /// /// /// - protected virtual async Task UpdateValidAsync(TEntity idEntity, TUpdateInput dto) + protected virtual Task UpdateValidAsync(TEntity idEntity, TUpdateInput dto) { - return; + return Task.CompletedTask; } /// diff --git a/Yi.Framework.Net6/Yi.Framework.WebCore/AspNetCoreExtensions/AutoMapperExtension.cs b/Yi.Framework.Net6/Yi.Framework.WebCore/AspNetCoreExtensions/AutoMapperExtension.cs index b227fba3..78c02d9f 100644 --- a/Yi.Framework.Net6/Yi.Framework.WebCore/AspNetCoreExtensions/AutoMapperExtension.cs +++ b/Yi.Framework.Net6/Yi.Framework.WebCore/AspNetCoreExtensions/AutoMapperExtension.cs @@ -1,4 +1,5 @@ -using Microsoft.AspNetCore.Builder; +using AutoMapper; +using Microsoft.AspNetCore.Builder; using Microsoft.Extensions.DependencyInjection; using System; using System.IO; @@ -15,8 +16,11 @@ namespace Yi.Framework.WebCore.AspNetCoreExtensions public static IServiceCollection AddAutoMapperService(this IServiceCollection services) { //这里会通过反射自动注入的,先临时这样 - services.AddAutoMapper(typeof(AutoMapperProfile),typeof(StudentProfile)); - + + var profileList = Common.Helper.AssemblyHelper.GetClassByBaseClassesAndInterfaces("Yi.Framework.DTOModel", typeof(Profile)); + profileList.Add(typeof(AutoMapperProfile)); + services.AddAutoMapper(profileList.ToArray()); + return services; } }