mirror of https://github.com/abpframework/abp.git
7 changed files with 63 additions and 6 deletions
@ -0,0 +1,20 @@ |
|||||
|
using System.Linq; |
||||
|
using System.Reflection; |
||||
|
using Microsoft.AspNetCore.Mvc.ApplicationParts; |
||||
|
|
||||
|
namespace Microsoft.Extensions.DependencyInjection |
||||
|
{ |
||||
|
public static class AbpMvcBuilderExtensions |
||||
|
{ |
||||
|
public static void AddApplicationPartIfNotExists(this IMvcBuilder mvcBuilder, Assembly assembly) |
||||
|
{ |
||||
|
if (mvcBuilder.PartManager.ApplicationParts.Any( |
||||
|
p => p is AssemblyPart assemblyPart && assemblyPart.Assembly == assembly)) |
||||
|
{ |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
mvcBuilder.PartManager.ApplicationParts.Add(new AssemblyPart(assembly)); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue