Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting types just found during Scan #213

Open
dario-l opened this issue Sep 29, 2023 · 6 comments
Open

Getting types just found during Scan #213

dario-l opened this issue Sep 29, 2023 · 6 comments

Comments

@dario-l
Copy link

dario-l commented Sep 29, 2023

Simply question.

Is there any possibility to take those types just gathered by Scrutor?
I do not want to iterate again.

@khellang
Copy link
Owner

Hey @dario-l! 👋🏻

Not types specifically added by Scrutor, but you can enumerate the descriptors in the service collection to see which types were added.

@dario-l
Copy link
Author

dario-l commented Oct 10, 2023

Hi @khellang
Damn, that's a shame. Scrutor scans for all types that I want to register in contaoner but after that I need to run scan/search method again instead of get the result of that scan straight from scrutor. 😞

Something like this could be great addition. 😃

@dario-l
Copy link
Author

dario-l commented Oct 10, 2023

Hi @khellang again 😃
Just found a solution. This will work?

        var tempServices = new ServiceCollection();

        tempServices.Scan(  );
        
        foreach (var x in tempServices)
        {
            services.Add(x);
        }

@khellang
Copy link
Owner

Yes, that will work 👍

@dario-l
Copy link
Author

dario-l commented Oct 10, 2023

Great. Thanks 👍🏻

@xingzuhui
Copy link

Set do,not single。 services.Add(tempServices.Scan( )); instead if you can。Never intend to use loop if we don't need。

Hi @khellang again 😃 Just found a solution. This will work?

        var tempServices = new ServiceCollection();

        tempServices.Scan(  );
        
        foreach (var x in tempServices)
        {
            services.Add(x);
        }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants