Codit / practical-api-guidelines

Practical guidelines for building & designing APIs with .NET.
MIT License
16 stars 5 forks source link

One repository per aggregate root, and not one global repository. #96

Open MassimoC opened 5 years ago

MassimoC commented 5 years ago

You should have a repository per aggregate root, and not one global repository. I think in this domain model, we currently have only one aggregate root, which would be Car

IMHO it makes no sense to have a method GetAllCustomizations; you'll rather retrieve the Customizations that are available per CarBodyType instead.

Actually, I'd create this model in a whole other fashion, but I do not know how 'free' you are to do so. I'd suggest to have an entity Car which has a property Brand and a property that reflects its type. That property should not be an entity itself as it is a value-type.
But that might be outside the scope of this project :)

_Originally posted by @fgheysels

pietersap commented 5 years ago

@fgheysels It's not entirely clear to me what you mean. The car entity already has properties Brand and CarBodyType. Currently, the API supports querying all cars and filtering on a specific body type (in the GetCarsAsync method). Listing all customizations relating to the selected cars with the specific body type could be added to the API later, otherwise it would be up to the end-user of the API.