Skip to content

Documentation Update #1295

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

Closed
btecu opened this issue Aug 16, 2023 · 3 comments · Fixed by #1296
Closed

Documentation Update #1295

btecu opened this issue Aug 16, 2023 · 3 comments · Fixed by #1296
Labels

Comments

@btecu
Copy link
Contributor

btecu commented Aug 16, 2023

Can the model be shared with the EF Core entity?
When trying, getting Partial declarations of 'UsersController' must not specify different base classes, but it's unclear if that's the issue.

Using the latest nuget package with EF Core 7 and .NET 7, the documentation steps don't seem to match, so it be great if it could be reviewed and updated.

For example https://www.jsonapi.net/usage/resource-graph.html suggests using this:
builder.Services.AddJsonApi<AppDbContext>(discovery => discovery.AddCurrentAssembly());

However, .AddCurrentAssembly() doesn't seem to exist.

@btecu btecu added the question label Aug 16, 2023
@bkoelman
Copy link
Member

Please try this instead:

builder.Services.AddJsonApi<AppDbContext>(
    discovery: discovery => discovery.AddCurrentAssembly())

See the named parameters at:

public static IServiceCollection AddJsonApi(this IServiceCollection services, Action<JsonApiOptions>? options = null,
Action<ServiceDiscoveryFacade>? discovery = null, Action<ResourceGraphBuilder>? resources = null, IMvcCoreBuilder? mvcBuilder = null,
ICollection<Type>? dbContextTypes = null)

@btecu
Copy link
Contributor Author

btecu commented Aug 17, 2023

Thanks @bkoelman, that worked!
I'll leave the issue open in case you want to track the documentation update.

@bkoelman
Copy link
Member

Thanks for reporting this. Updated docs are available at https://www.jsonapi.net/usage/resource-graph.html.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging a pull request may close this issue.

2 participants