I am migrating from .NET Core 2.2 to 3.1. In doing so, I have updated the JsonApiDotNetCore package from 3.1 to 4.0.0 alpha 4.
In 2.2, I used JsonApiDotNetCore 3.1 and was using BuildResourceGraph to add any JSON API resources to the resource graph. Code below:
IMvcCoreBuilder objMvcCoreBuilder = null;
objServices.AddJsonApi((objOptions) =>
{
objOptions.BuildResourceGraph((objBuilder) =>
{
objBuilder
.AddResource<Register>("registers")
.AddResource<Client>("clients")
;
});
}, objMvcCoreBuilder);
But, I get the following error:
'JsonApiOptions' does not contain a definition for 'BuildResourceGraph' and no accessible extension method 'BuildResourceGraph' accepting a first argument of type 'JsonApiOptions' could be found (are you missing a using directive or an assembly reference?)
What is the replacement for BuildResourceGraph?
After digging through the JsonApiOptions.cs
commit history on Git, I found the change:
IMvcCoreBuilder objMvcCoreBuilder = null;
objServices.AddJsonApi(
options => options.Namespace = "api/v1",
resources: resources =>
resources
.AddResource<Register>("registers")
.AddResource<Client>("clients")
,
mvcBuilder: objMvcCoreBuilder
);
Go down to the /NoEntityFrameworkExample/Startup.cs
file and you will see the diff that shows the change. Other than that, there is only a cryptic mention to renaming BuildResourceManager in the change log notes at the top of the site.
The revised version of the file is here: