For example I want to register all classes with Service attribute using StructureMap
[Service]
public class A {}
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
As far as I know you are required to create a custom
IRegistrationConventionfound in theStructureMap.GraphNamespace.Implement the convention
Add the convention to the scanner
Remarks
If you are free on your decision you may want to use interfaces instead of attributes. Using an Interface you are able to provide a common contract for all classes and they are way easier to work with when the project grows.
Attributes have a tendency to spread all over your code, refactoring them can be a real pain. Interfaces have much better tooling support when it comes to refactoring.
I am using interfaces for a similar task (plugin system) a convention like
usage would be similar:
If your convention takes constructor arguments you can use
With: