-
Notifications
You must be signed in to change notification settings - Fork 16
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
Implement Dependency Injection #44
Comments
Here's a good blog post from someone much smarter than me: http://blog.ploeh.dk/2014/05/19/di-friendly-library/ Mark wrote a book called Dependency Injection in .NET. I think that every decision here should be based on his book and articles. |
I think we should go with the netcore dependency injection. It's simple and easy to used and adapters into more popular frameworks such as Autofac, StructureMap, etc. exist. Registering modules is done via an extension method (as it is recommended on Github/MSDN), much like this:
This gives us everything we need and we can put everything together in the GW2.NET main app. I'm just thinking how we can implement configuration for the various parts. In ASP.NET you can do something like this: |
Can this be completely optional? As in you should be able to use a ServiceCollection to resolve services without taking away the option to construct services manually. |
Yes and no. The services and converter won't be made into internal/protected classes but will stay public, so the user can choose to manually create an instance of, say, I'm still thinking how we can make the api endpoints available in a type safe way. I found a way around the configuration problem (enter: Factory, which I totally missed), but not this one. |
ref #34 #5
The text was updated successfully, but these errors were encountered: