我正在寻找JsonApiFramework的the samples,用于JSON:API服务器。
对于关系,库正在生成相对链接。例如,这是从文章编号3到该文章的博客的关系:
http://localhost:12000/articles/3/blog
以下是建立关系的配置:
public class ArticleConfiguration : ResourceTypeBuilder<Article>
{
public ArticleConfiguration()
{
// Attributes to Ignore
this.Attribute(x => x.BlogId).Ignore();
this.Attribute(x => x.AuthorId).Ignore();
// Relationships
this.ToOneRelationship<Blog>("blog");
this.ToOneRelationship<Person>("author");
this.ToManyRelationship<Comment>("comments");
}
}
但是,我的服务应生成指向资源规范路径的路径。像这样:
http://localhost:12000/blog/2
也许甚至是这样:
http://localhost:12000/1071a038-4a5a-4ace-b0f9-cbc69db1e296
如何设置?