I'm building a Web API. To give meaning to my controller methods I want classes that specify what properties are used for each particular operation. This would make the code easier to understand, and auto generated api docs would also be more meaningful.
Is there an existing pattern or at least semi standard that can give me some guidance on how to name classes such as those below?
// Used for POST /entities or PUT /entities/:id
class EntityCommandDto
{
public string EditableProperty { get; set; }
}
// Used for GET /entities as IEnumerable<EntityQueryDto>
class EntityQueryDto : EntityCommandDto
{
// Id is read only so no need to have it in the base class
public int Id { get; set; }
}
// Used for GET /entities/:id
class ExpensiveQueryDto : EntityQueryDto
{
// Don't want this when getting the whole colletion so I created a separate class
public object ExpensiveRelatedEntity { get; set; }
}