Skip to content

Commit

Permalink
Merge pull request #34 from netcorepal/v2.1.0
Browse files Browse the repository at this point in the history
use framework v2.1.0
  • Loading branch information
witskeeper authored Jan 10, 2025
2 parents 2c128b7 + 5f78c3f commit 45a7f7c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion template/Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<NetCorePalVersion>2.0.0</NetCorePalVersion>
<NetCorePalVersion>2.1.0</NetCorePalVersion>
<FrameworkVersion>9.0.0</FrameworkVersion>
<ExtensionsVersion>9.0.0</ExtensionsVersion>
<EntityFrameworkVersion>9.0.0</EntityFrameworkVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,20 @@ public static class SwaggerGenOptionsExtionsions
{
public static SwaggerGenOptions AddEntityIdSchemaMap(this SwaggerGenOptions swaggerGenOptions)
{
// 加载domain程序集
Assembly domainAssembly = Assembly.Load("ABC.Template.Domain");
foreach (var type in domainAssembly.GetTypes())
foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies()
.Where(p => p.FullName != null && p.FullName.Contains("ABC.Template")))
{
if (type.IsClass && Array.Exists(type.GetInterfaces(), p => p == typeof(IEntityId)))
foreach (var type in assembly.GetTypes())
{
swaggerGenOptions.MapType(type, () => new OpenApiSchema { Type = typeof(string).Name.ToLower() });
if (type.IsClass && Array.Exists(type.GetInterfaces(), p => p == typeof(IEntityId)))
{
swaggerGenOptions.MapType(type,
() => new OpenApiSchema { Type = typeof(string).Name.ToLower() });
}
}
}

return swaggerGenOptions;
}
}
}
}

0 comments on commit 45a7f7c

Please sign in to comment.