-
-
Notifications
You must be signed in to change notification settings - Fork 158
Provide API for easy service/repo registration #384
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
Comments
I should mention that having |
Why should it error out? You're simply registering a dependency. The fact that the former doesn't work, should be entirely dependent upon how you're requesting the dependency in your controller/service. For example, if in your controller you request public class FooController : JsonApiController<Foo>
{
public PeopleController(
IJsonApiContext jsonApiContext,
IResourceService<Foo> resourceService, // <-- id type not specified
ILoggerFactory loggerFactory)
: base(jsonApiContext, resourceService, loggerFactory)
{ }
}
// requires
services.Add<IResourceService<Foo>, FooService>(); but, if your controller requests the id specific type public class FooController : JsonApiController<Foo, int>
{
public PeopleController(
IJsonApiContext jsonApiContext,
IResourceService<Foo, int> resourceService, // <-- id type specified
ILoggerFactory loggerFactory)
: base(jsonApiContext, resourceService, loggerFactory)
{ }
}
// requires
services.Add<IResourceService<Foo, int>, FooService>(); That said, we might be able to do something with Roslyn analyzers that would produce a warning if you've registered a dependency that is not used in any constructor arguments 🤷♂️ |
That makes sense. |
Description
should register any applicable forms:
It should also handle services with mappings:
This API may be usable by the service discovery pipeline
The text was updated successfully, but these errors were encountered: