Registration by Convention?
See original GitHub issueI am really looking to give Grace a try on a NetCore 3.0 project.
I see you can find named instance (withKey:) lookups, which was a requirement for us.
The last thing we were looking at was RegistrationByConvention (ala Unity)?
AllClasses from a specific assembly, with matching name interfaces (MyClass -> IMyClass).
var repositoriesAndServices =
AllClasses
.FromLoadedAssemblies()
.Where(obj => obj.ToString().Contains("MyProject.Services.")
|| obj.ToString().Contains("MyProject.Repositories."));
container.RegisterTypes(repositoriesAndServices,
WithMappings.FromMatchingInterface,
WithName.Default,
WithLifetime.ContainerControlled);
I see another ticket #136 that mentions Strategies. If this is indeed how I would go about using resolution strategies, could you provide a demonstration? I didn’t find this in the Wiki/Api Docs.
Or if there is a completely different approach provided by Grace
really just need the end result to be the same so we generally don’t want to manually wire up the code getting us hamstrung.
Issue Analytics
- State:
- Created 4 years ago
- Comments:14 (9 by maintainers)
Top Results From Across the Web
Registration Convention
The Registration Convention was considered and negotiated by the Legal Subcommittee from 1962. It was adopted by the General Assembly in 1974 (General...
Read more >Registration Convention
The Convention on Registration of Objects Launched into Outer Space was adopted by the United Nations General Assembly in 1974 and went into...
Read more >Convention on Registration of Objects Launched into Outer ...
1. When a space object is launched into earth orbit or beyond, the launching. State shall register the space object by means of...
Read more >unitycontainer/registration-by-convention
Registration By Convention. Code of Conduct. This project has adopted the code of conduct defined by the Contributor Covenant to clarify expected behavior ......
Read more >Convention on Registration of Objects Launched into Outer ...
The Convention was adopted by resolution 3235 (XXIX) of the General Assembly dated 12 November 1974, pursuant to resolution 3182 (XXVIII) 2 dated...
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
@houseofcat I’m in the middle of doing 7.1.0 so it would be a good time to add functionality like this.
There is already the ability to export a type set by interface or attributed interface. So adding something that exports when the interface name matches seems like a very nice convention.
You mention the need for looking up by key. Is that a function of the fact the unity required it when registering or is this something that is located later with a key?
Thanks Ian!