saule
v1.8.0
Saule은 ASP.Net Web API 2용 JSON API(버전 1.0) 라이브러리입니다. NuGet을 사용하여 Saule를 설치합니다.
Install-Package saule
Saule를 사용하려면 도메인에 대한 정보가 포함된 리소스를 정의해야 합니다.
공용 클래스 PersonResource : ApiResource{ public PersonResource() { Attribute("FirstName"); Attribute("성"); Attribute("나이"); BelongsTo<CompanyResource>("작업"); HasMany<PersonResource>("친구"); }}public class CompanyResource : ApiResource{ public CompanyResource() { Attribute("이름"); Attribute("직원 수"); }}그런 다음 이를 사용하여 모든 클래스를 Json Api로 직렬화할 수 있습니다(클래스에 모델과 동일한 이름의 속성이 있는 경우).
public class PersonController : ApiController{ [HttpGet] [ReturnsResource(typeof(PersonResource))] [Route("people/{id}")] public JohnSmith GetPerson(string id) { return new JohnSmith(); }} GET http://example.com/people/123{ "data": { "type": "person", "id": "123", "attributes": { "first-name": "John", " 성": "스미스", "나이": 34
}, "관계": { "직업": { "링크": { "self": "http://example.com/people/123/relationships/job/", "관련": "http://example .com/people/123/job/"
}, "데이터": { "유형": "회사", "ID": "456"
}
}, "친구": { "링크": { "자체": "http://example.com/people/123/relationships/friends/", "관련": "http://example.com/people/ 123/친구/"
}, "데이터": [
{ "유형": "사람", "ID": "789"
}
]
}
}
}, "포함됨": [
{ "type": "회사", "id": "456", "attributes": { "name": "Awesome, Inc.", "직원 수": 24
}
},
{ "type": "사람", "id": "789", "attributes": { "first-name": "Sara", "last-name": "Jones", "age": 38
}
}
], "링크": { "self": "http://example.com/people/123"
}
}역직렬화는 일반 웹 API와 동일하게 작동합니다. 이 작업을 수행하기 위해 특별한 작업을 수행할 필요는 없습니다.
새 릴리스를 만들려면 아래 단계를 따르세요.
release-v<version> (예: release-v1.5 )이라는 분기를 만듭니다.
master 의 appveyor.yml 에서 버전 번호를 늘립니다.
두 변경 사항을 모두 푸시하고 빌드를 기다립니다.
릴리스 노트를 Github의 릴리스 설명에 복사하세요.
새 릴리스 게시