Closed jaduff closed 6 years ago
Maybe it is that the model is wrong then. Perhaps the aggregate root is School and you add computers to a room in a school, and record damage by students in a school on computers in a room in a school.
Perhaps I am thinking about this wrong. Two physical rooms don't have the same name, so two rooms in the domain also shouldn't. But this isn't "can't". Someone could put the same room name on two rooms, but don't, because its not helpful. Following the same idea, it is up to the person doing the data entry to avoid this problem. So rather than having it as a domain issue, with Write Model validation checking, it could be left up to the interface to suggest that this is a bad idea. So it could be possible to create two rooms, but ill-advised.
Except I wanted to use Admin/room/
This isn't ideal for a couple of reasons. If rooms can be renamed, then they aren't the identity of the entity. This is why we have a Guid. -Problems this can cause are: people having deep links -SEO
A common solution is to combine an identifier and the name, using "Url Rewriting". Admin/123-45-95-2-ComputerScienceRoom So we both have the id and a friendly name
Does URL Rewriting need to be done manually through routes? Or is there an automatic translation process? Everything I've been able to find is about manually specified routes.
Or could I use the template? template: "{controller=Admin}/{action=Index}/{id?}/{Name?}"
That would work yes
A room name must be unique. Two rooms can have their names swapped, so they still need a GUID. But no two rooms can have the same name simultaneously.