Error with JSON API Framework

502 views Asked by At

I have a .NET solution containing a DAL project with the configuration for my entities and a Web API Project containing all my entities which are imported from SQL Server and my controllers are implemented.
When I run the project I have this error (comment is one of the entities which has one-to-many relationship with 2 other entities):

An exception of type 'JsonApiFramework.ServiceModel.ServiceModelException' occurred in JsonApiFramework.Core.dll but was not handled in user code

Additional information: JsonApiFramework.ServiceModel.Internal.ResourceType [clrType=Comment] has missing ResourceIdentityInfo metadata. Ensure metadata is configured correctly for the respective domain/schema.

enter image description here

2

There are 2 answers

2
SIALA Sofiene On BEST ANSWER

I finally solved the problem. To work efficiently with Json API, the id of every entity should be named simply id. My Entity named Business had an id named idBus. So when I changed the name idBus to id, it all worked.

I hope this can help anybody.

0
Wouter On

You can do the following aswell (if you don't wan't to change your id names):

public class BusinessConfiguration : ResourceTypeBuilder<Business>
{
    public BusinessConfiguration()
    {
        this.ResourceIdentity(x => x.idBus).SetApiType("business");

    }
}