-
-
Notifications
You must be signed in to change notification settings - Fork 158
Bug: D/I container selects the wrong class #604
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
@bart-degreed there's nothing evidently wrong with the code you're sharing. If you can share your ApiFrameworkTryout2 repository or a similar small reproduction repository I can look into it further. |
I have created a minimal repro solution: ApiDependencyBugRepro.zip See code in Startup.cs: const bool showError = true;
if (showError)
{
var mvcBuilder = services.AddMvcCore();
services.AddJsonApi(options =>
{
options.Namespace = "api";
}, mvcBuilder, discovery => discovery.AddCurrentAssembly());
}
else
{
services.AddJsonApi<AppDbContext>(options =>
{
options.Namespace = "api";
});
} the first block throws, while the second ( |
Got it: |
The problem is an issue with the auto discovery not correctly determining to which resource your custom service belongs to. It has already been fixed in v4 in #591. You can check out the latest version of the master branch for this fix, I'm planning on doing an alpha release next week. (There are a bunch of breaking changes among which an update to .net core 3, so I'm hoping to create a first draft of the migration guide before doing so) Thanks for reporting the issue nevertheless :) |
Thanks for looking into this. |
Description
I have an EF model with two entities: User and Content. Created controllers etc according to getting-started documentation.
I wanted to override filtering for Content, so created custom classes:
Registered them as described at https://json-api-dotnet.github.io/#/layer-overview:
Now getting a list of content works as expected, but getting a list of users returns:
Version used: 4.0.0-alpha3
The text was updated successfully, but these errors were encountered: