Exemplo n.º 1
0
        public static List <Type> FindDependedModuleTypes(Type moduleType)
        {
            if (!AbpModule.IsAbpModule(moduleType))
            {
                throw new ArgumentException("Given type is not an ABP module: " + moduleType.AssemblyQualifiedName);
            }
            var dependencies = new List <Type>();

            var dependencyDescriptors = moduleType
                                        .GetCustomAttributes()
                                        .OfType <IDependedTypesProvider>();

            foreach (var descriptor in dependencyDescriptors)
            {
                foreach (var dependedModuleType in descriptor.GetDependedTypes())
                {
                    dependencies.AddIfNotContains(dependedModuleType);
                }
            }

            return(dependencies);
        }
Exemplo n.º 2
0
    public List <Type> GetModules()
    {
        var modules = new List <Type>();

        foreach (var assembly in GetAssemblies())
        {
            try
            {
                foreach (var type in assembly.GetTypes())
                {
                    if (AbpModule.IsAbpModule(type))
                    {
                        modules.AddIfNotContains(type);
                    }
                }
            }
            catch (Exception ex)
            {
                throw new AbpInitializationException("Could not get module types from assembly: " + assembly.FullName, ex);
            }
        }
        return(modules);
    }
 public override bool CanCreate(Type type)
 {
     return(base.CanCreate(type) || AbpModule.IsAbpModule(type));
 }