abpframework / abpframework/abp

Document ITypeFinder

Open
#12,998 1 comment 0 reactions 1 assignee View on GitHub

@hikalkan is already working on this.

Since Jun 14, 2022.

documentation
Dominant language
C#
Stars
14.4k
Forks
3.7k
Avg merge
15h 32m
Merged PRs (30d)
106

Description

ITypeFinder can be used to discover types in the application, even before the dependency injection registration phase completed.

Example usage:

public override void PreConfigureServices(ServiceConfigurationContext context)
{
    var typeFinder = context.Services.GetSingletonInstance<ITypeFinder>();
    foreach (var type in typeFinder.Types)
    {
        if (type.IsAssignableTo<Control>())
        {
            // do something...
        }
    }
}

After the dependency injection phase completed, you can inject ITypeFinder into any class.

ITypeFinder makes it easy to find all types of the application without manually searching all the assemblies. It also makes the assembly search only once, so it is optimized.

There is also IAssemblyFinder to get all assemblies in the application.

Note that assemblies and types are returned only for the assemblies with AbpModule classes.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.