mirror of https://github.com/abpframework/abp.git
12 changed files with 54 additions and 23 deletions
@ -1,9 +1,11 @@ |
|||||
using System; |
using System; |
||||
|
using JetBrains.Annotations; |
||||
|
|
||||
namespace Volo.Abp.Modularity |
namespace Volo.Abp.Modularity |
||||
{ |
{ |
||||
public interface IDependedModuleTypesProvider |
public interface IDependedModuleTypesProvider |
||||
{ |
{ |
||||
|
[NotNull] |
||||
Type[] GetDependedModuleTypes(); |
Type[] GetDependedModuleTypes(); |
||||
} |
} |
||||
} |
} |
||||
@ -1,11 +1,12 @@ |
|||||
using Volo.DependencyInjection; |
using JetBrains.Annotations; |
||||
|
using Volo.DependencyInjection; |
||||
|
|
||||
namespace Volo.Abp.Modularity |
namespace Volo.Abp.Modularity |
||||
{ |
{ |
||||
public interface IModuleLifecycleContributer : ISingletonDependency |
public interface IModuleLifecycleContributer : ISingletonDependency |
||||
{ |
{ |
||||
void Initialize(IAbpModule module); |
void Initialize([NotNull] IAbpModule module); |
||||
|
|
||||
void Shutdown(IAbpModule module); |
void Shutdown([NotNull] IAbpModule module); |
||||
} |
} |
||||
} |
} |
||||
|
|||||
@ -1,10 +1,11 @@ |
|||||
using System; |
using System; |
||||
using System.Collections.Generic; |
using JetBrains.Annotations; |
||||
|
|
||||
namespace Volo.Abp.Modularity.PlugIns |
namespace Volo.Abp.Modularity.PlugIns |
||||
{ |
{ |
||||
public interface IPlugInSource |
public interface IPlugInSource |
||||
{ |
{ |
||||
List<Type> GetModules(); |
[NotNull] |
||||
|
Type[] GetModules(); |
||||
} |
} |
||||
} |
} |
||||
@ -1,18 +1,21 @@ |
|||||
using System; |
using System; |
||||
using System.Collections.Generic; |
|
||||
using System.Linq; |
using System.Linq; |
||||
|
using JetBrains.Annotations; |
||||
|
|
||||
namespace Volo.Abp.Modularity.PlugIns |
namespace Volo.Abp.Modularity.PlugIns |
||||
{ |
{ |
||||
public static class PlugInSourceExtensions |
public static class PlugInSourceExtensions |
||||
{ |
{ |
||||
public static List<Type> GetModulesWithAllDependencies(this IPlugInSource plugInSource) |
[NotNull] |
||||
|
public static Type[] GetModulesWithAllDependencies([NotNull] this IPlugInSource plugInSource) |
||||
{ |
{ |
||||
|
Check.NotNull(plugInSource, nameof(plugInSource)); |
||||
|
|
||||
return plugInSource |
return plugInSource |
||||
.GetModules() |
.GetModules() |
||||
.SelectMany(AbpModuleHelper.FindAllModuleTypes) |
.SelectMany(AbpModuleHelper.FindAllModuleTypes) |
||||
.Distinct() |
.Distinct() |
||||
.ToList(); |
.ToArray(); |
||||
} |
} |
||||
} |
} |
||||
} |
} |
||||
@ -1,17 +1,19 @@ |
|||||
using System; |
using System; |
||||
using System.Collections.Generic; |
using System.Collections.Generic; |
||||
using System.Linq; |
using System.Linq; |
||||
|
using JetBrains.Annotations; |
||||
|
|
||||
namespace Volo.Abp.Modularity.PlugIns |
namespace Volo.Abp.Modularity.PlugIns |
||||
{ |
{ |
||||
public class PlugInSourceList : List<IPlugInSource> |
public class PlugInSourceList : List<IPlugInSource> |
||||
{ |
{ |
||||
internal List<Type> GetAllModules() |
[NotNull] |
||||
|
internal Type[] GetAllModules() |
||||
{ |
{ |
||||
return this |
return this |
||||
.SelectMany(pluginSource => pluginSource.GetModulesWithAllDependencies()) |
.SelectMany(pluginSource => pluginSource.GetModulesWithAllDependencies()) |
||||
.Distinct() |
.Distinct() |
||||
.ToList(); |
.ToArray(); |
||||
} |
} |
||||
} |
} |
||||
} |
} |
||||
@ -1,17 +1,22 @@ |
|||||
using System; |
using System; |
||||
using System.IO; |
using System.IO; |
||||
|
using JetBrains.Annotations; |
||||
|
|
||||
namespace Volo.Abp.Modularity.PlugIns |
namespace Volo.Abp.Modularity.PlugIns |
||||
{ |
{ |
||||
public static class PlugInSourceListExtensions |
public static class PlugInSourceListExtensions |
||||
{ |
{ |
||||
public static void AddFolder(this PlugInSourceList list, string folder, SearchOption searchOption = SearchOption.TopDirectoryOnly) |
public static void AddFolder([NotNull] this PlugInSourceList list, [NotNull] string folder, SearchOption searchOption = SearchOption.TopDirectoryOnly) |
||||
{ |
{ |
||||
|
Check.NotNull(list, nameof(list)); |
||||
|
|
||||
list.Add(new FolderPlugInSource(folder, searchOption)); |
list.Add(new FolderPlugInSource(folder, searchOption)); |
||||
} |
} |
||||
|
|
||||
public static void AddTypes(this PlugInSourceList list, params Type[] moduleTypes) |
public static void AddTypes([NotNull] this PlugInSourceList list, params Type[] moduleTypes) |
||||
{ |
{ |
||||
|
Check.NotNull(list, nameof(list)); |
||||
|
|
||||
list.Add(new PlugInTypeListSource(moduleTypes)); |
list.Add(new PlugInTypeListSource(moduleTypes)); |
||||
} |
} |
||||
} |
} |
||||
|
|||||
Loading…
Reference in new issue