Registering Classes.FromThisAssembly() doesn't do anything
See original GitHub issueTrying to register all classes with the following syntax does nothing, although it compiles just fine and there’s nothing obvious to indicate why it wouldn’t register all types in my assembly.
container.Register(Classes.FromThisAssembly());
The correct syntax, I’ve finally discovered, is to use the .Pick()
descriptor
container.Register(Classes.FromThisAssembly().Pick());
It seems to me that that the registration should either default to use Pick() if no other descriptor is provided or throw an exception indicating the operation isn’t allowed. A better solution would be, if possible, to prevent passing in the return type of any FromAssembly())
method into the registration method, although I suspect that would be fairly more complicated.
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (6 by maintainers)
Top Results From Across the Web
Registering a class from an unreferenced assembly with ...
Have you tried something like this container.Register( Classes .FromAssemblyNamed("MyProject.Web").Where(t => t.FullName == "MyProject.Web.
Read more >c# - Registering dependency implemented in separate ...
I have a project with a Business Layer (WizBang.BL) that contains nearly all of my application logic. It communicates with a Data Layer...
Read more >Error 19 - Cannot register assembly. Exception has been ...
No, there is no code in my class constructor. - No, I am not mixing versions of .NET - Yes, registering does work...
Read more >Dynamically Loading Assemblies for Dependency Injection ...
I try to register class library but the method System.Runtime.Loader.AssemblyLoadContext.Default.LoadFromAssemblyPath(assemblyPath); is not ...
Read more >Dependency injection for a library with internal dependencies
In the web site's composition root, they just need to register the default repository locator. IMO the web site doesn't even need to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@danquist - Any questions we will help you out.
Sure thing, I’d be willing to do that. Might take me a week or two to set up my environment and submit the PR though since I haven’t contributed to Windsor before 😃