public AssemblyScanner(IAssemblyFinder assemblyFinder, ILogger <AssemblyScanner> logger) { this.assemblyFinder = assemblyFinder ?? throw new ArgumentNullException(nameof(assemblyFinder)); this.logger = logger ?? throw new ArgumentNullException(nameof(logger)); LoadAssemblies(); }
private static IEnumerable <Assembly> GetReferencedAssemblies(IAssemblyFinder finder, Type type) { MicroStrutLibraryExceptionHelper.IsNull(finder, typeof(ReflectionHelper).FullName, LogLevel.Error, "类型查找器为空!"); MicroStrutLibraryExceptionHelper.IsNull(type, typeof(ReflectionHelper).FullName, LogLevel.Error, "类型为空!"); Assembly typeAssembly = type.GetTypeInfo().Assembly; return(finder.GetAssemblies().Where(assembly => { if (assembly.IsDynamic) { return false; } if (assembly.FullName == typeAssembly.FullName) { return true; } return assembly.GetReferencedAssemblies().Any(assemblyName => { return assemblyName.FullName == typeAssembly.FullName; }); })); }
public FunctionHandler(IAssemblyFinder assemblyFinder, ILoggerFactory loggerFactory, IActionDescriptorCollectionProvider actionProvider, IServiceProvider serviceProvider) { _assemblyFinder = assemblyFinder; _logger = loggerFactory.CreateLogger(typeof(FunctionHandler)); _actionProvider = actionProvider; _serviceProvider = serviceProvider; }
public EntityConfigsBootstrapper(IRepository <EntityConfig, Guid> entityConfigRepository, IEntityConfigurationStore entityConfigurationStore, IAssemblyFinder assembleFinder, IRepository <EntityProperty, Guid> entityPropertyRepository, IMetadataProvider metadataProvider) { _entityConfigRepository = entityConfigRepository; _entityConfigurationStore = entityConfigurationStore; _assembleFinder = assembleFinder; _entityPropertyRepository = entityPropertyRepository; _metadataProvider = metadataProvider; }
public AutoMapperBootstrapper(IAssemblyFinder assemblyFinder = null) { _typeFinder = new TypeFinder(); if (assemblyFinder != null) { _typeFinder.AssemblyFinder = assemblyFinder; } }
public ApplicationEngine(IAssemblyFinder assemblyFinder, IAssemblyFilter assemblyFilter, IAssemblyListWriterFactory assemblyListWriterFactory) { _assemblyFinder = assemblyFinder; _assemblyFilter = assemblyFilter; _assemblyListWriterFactory = assemblyListWriterFactory; }
public CachingAssemblyFinderDecorator(IAssemblyFinder innerFinder) { ArgumentUtility.CheckNotNull("innerFinder", innerFinder); _innerFinder = innerFinder; _resultCache = new Lazy <IReadOnlyCollection <Assembly> > ( () => _innerFinder.FindAssemblies().ToList().AsReadOnly(), LazyThreadSafetyMode.ExecutionAndPublication); }
public static List <Tuple <string, string, Type> > GetTypeNameList(IAssemblyFinder finder, Type type) { MicroStrutLibraryExceptionHelper.IsNull(finder, typeof(ReflectionHelper).FullName, LogLevel.Error, "类型查找器为空!"); MicroStrutLibraryExceptionHelper.IsNull(type, typeof(ReflectionHelper).FullName, LogLevel.Error, "类型为空!"); //获取可用程序集 IEnumerable <Assembly> assemblies = GetReferencedAssemblies(finder, type); //获取可用类型 return(GetTypeNameList(assemblies, type)); }
/// <summary> /// Initializes a new instance of the <see cref="ConventionSyntax"/> class. /// </summary> /// <param name="bindingBuilder">The binding builder.</param> /// <param name="assemblyFinder">The assembly finder.</param> /// <param name="typeFilter">The type filter.</param> /// <param name="bindingGeneratorFactory">The binding generator factory.</param> public ConventionSyntax( IConventionBindingBuilder bindingBuilder, IAssemblyFinder assemblyFinder, ITypeFilter typeFilter, IBindingGeneratorFactory bindingGeneratorFactory) { this.bindingBuilder = bindingBuilder; this.assemblyFinder = assemblyFinder; this.typeFilter = typeFilter; this.bindingGeneratorFactory = bindingGeneratorFactory; }
/// <summary> /// Initializes a new instance of the <see cref="ConventionSyntax"/> class. /// </summary> /// <param name="bindingBuilder">The binding builder.</param> /// <param name="assemblyFinder">The assembly finder.</param> /// <param name="typeFilter">The type filter.</param> /// <param name="bindingGeneratorFactory">The binding generator factory.</param> public ConventionSyntax( IConventionBindingBuilder bindingBuilder, IAssemblyFinder assemblyFinder, ITypeFilter typeFilter, IBindingGeneratorFactory bindingGeneratorFactory) { this.bindingBuilder = bindingBuilder; this.assemblyFinder = assemblyFinder; this.typeFilter = typeFilter; this.bindingGeneratorFactory = bindingGeneratorFactory; }
private static Dictionary <string, Type> GetRegisterTypes(IServiceProvider provider) { IAssemblyFinder assemblyFinder = provider.GetRequiredService <IAssemblyFinder>(); IEnumerable <Type> registerTypes = ReflectionHelper.GetDerivedTypes(assemblyFinder, typeof(ICacheRegister)); Dictionary <string, Type> result = new Dictionary <string, Type>(); foreach (Type registerType in registerTypes) { TypeNameAttribute attr = ReflectionHelper.GetTypeName(registerType); if (attr != null) { result.Add(attr.Name, registerType); } } return(result); }
public static IServiceCollection AddConfiguration(this IServiceCollection services, IConfigurationRoot root) { MicroStrutLibraryExceptionHelper.IsNull(root, typeof(IServiceCollectionExtensions).FullName, LogLevel.Error, "根配置为空!"); services.AddSingleton <IConfigurationRoot>(root); IServiceProvider provider = services.BuildServiceProvider(); IAssemblyFinder assemblyFinder = provider.GetRequiredService <IAssemblyFinder>(); var registerType = typeof(IConfigurationRegister); var registerInstances = ReflectionHelper.GetDerivedTypes(assemblyFinder, registerType).Select(type => { return((IConfigurationRegister)Activator.CreateInstance(type)); }); foreach (var register in registerInstances.ToList()) { register.Register(services, root); } return(services); }
public BasicTypeFinder(IAssemblyFinder assemblyFinder) { _assemblyFinder = assemblyFinder; }
public TypeFinder(IAssemblyFinder assemblyFinder, ILogger <TypeFinder> logger) { _assemblyFinder = assemblyFinder; Logger = logger; }
public AutoSettingsProvider(IAssemblyFinder assemblyFinder) { _assemblyFinder = assemblyFinder; }
public PermissionProviderFinder() { AssemblyFinder = DefaultAssemblyFinder.Instance; }
/// <exception cref="ArgumentNullException"><paramref name="assemblyFinder"/> is <see langword="null" />.</exception> public TypeFinder(IAssemblyFinder assemblyFinder) { _assemblyFinder = assemblyFinder ?? throw new ArgumentNullException(nameof(assemblyFinder)); }
public AbpModuleLoader(AbpModuleCollection modules) { _modules = modules; AssemblyFinder = DefaultAssemblyFinder.Instance; Logger = NullLogger.Instance; }
public DefaultPermissionProviderFinder() { AssemblyFinder = DefaultAssemblyFinder.Instance; }
/// <summary> /// Constructor. /// </summary> public TypeFinder() { AssemblyFinder = CurrentDomainAssemblyFinder.Instance; Logger = NullLogger.Instance; }
public PermissionedObjectProviderBase(IAssemblyFinder assembleFinder) { _assembleFinder = assembleFinder; }
public TypeFinder(IAssemblyFinder assemblyFinder) { _assemblyFinder = assemblyFinder; }
public ApiPermissionedObjectProvider(IAssemblyFinder assembleFinder, IApiDescriptionGroupCollectionProvider apiDescriptionsProvider) : base(assembleFinder) { _apiDescriptionsProvider = apiDescriptionsProvider; }
/// <summary> /// 初始化一个新的<see cref="TypeFinder"/>对象 /// </summary> public TypeFinder() { //AssemblyFinder = CurrentDomainAssemblyFinder.Instance; AssemblyFinder = CurrentDomainBinDirectoryFinder.Instance; }
public DefaultModuleFinder() { AssemblyFinder = DefaultAssemblyFinder.Instance; }
public void SetUp() { _mockRepository = new MockRepository(); _finderMock = _mockRepository.StrictMock <IAssemblyFinder> (); }
public TypeFinder(IAssemblyFinder assemblyFinder) { _assemblyFinder = assemblyFinder; Logger = LogManager.GetLogger(GetType()); }
public TypeFinder(IAssemblyFinder assemblyFinder) { _assemblyFinder = assemblyFinder; _types = new Lazy <IReadOnlyList <Type> >(FindAll, LazyThreadSafetyMode.ExecutionAndPublication); }
public AutoMapperBootstrapper(IAssemblyFinder assemblyFinder=null) { _typeFinder = new TypeFinder(); if (assemblyFinder != null) _typeFinder.AssemblyFinder = assemblyFinder; }
/// <summary> /// Initializes a new instance of the <see cref="AssemblyFinderTypeDiscoveryService"/> class with a specific <see cref="AssemblyFinder"/> /// instance. /// </summary> /// <param name="assemblyFinder">The assembly finder used by this service instance to retrieve types.</param> public AssemblyFinderTypeDiscoveryService(IAssemblyFinder assemblyFinder) { ArgumentUtility.CheckNotNull("assemblyFinder", assemblyFinder); _assemblyFinder = assemblyFinder; _baseTypeCache = new Lazy <BaseTypeCache> (CreateBaseTypeCache); }
public TypeFinder() { AssemblyFinder = CurrentDomainAssemblyFinder.Instance; //Logger = NullLogger.Instance; }
public TypeFinder(IAssemblyFinder assemblyFinder) { _assemblyFinder = assemblyFinder; Logger = NullLogger.Instance; }
public DefaultTypeFinder(IAssemblyFinder assemblyFinder) { _assemblyFinder = assemblyFinder; }
/// <summary> /// Ctor /// </summary> /// <param name="assemblyFinder"></param> public AppDomainTypeFinder(IAssemblyFinder assemblyFinder) { _assemblyFinder = assemblyFinder; }
public TypeFinder(IAssemblyFinder assemblyFinder) { _assemblyFinder = assemblyFinder; Logger = NullLogger.Instance; }
public TypeFinder() { AssemblyFinder = CurrentDomainAssemblyFinder.Instance; }
public AbpEntityFrameworkModule() { AssemblyFinder = DefaultAssemblyFinder.Instance; }
public EntityPermissionedObjectProvider(IAssemblyFinder assembleFinder) : base(assembleFinder) { }
public DbConfiguration() { AssemblyFinder =new CurrentDomainAssemblyFinder(); }