Managing names in a project and the size of the Pages folder

as i am working on a large project i find the default of having all the generated pages in the pages folder becomes a bit of a problem.

i am not sure if this is a good idea but it might be a help.

when scaffolded pages are created from a datastore a pattern happens with the names of the razor files in this way:

Contacts Table is scaffolded and the razor pages are created as
Contacts.razor
AddContact.razor and
EditContact.razor

with larger number of tables the Pages folder can get very large and the app menu also gets large.

the menu i think needs the developer to manage that....

but the pages folder might be changed to a structure more like this:

/Pages/Contacts/Contacts.razor
/Pages/Contacts/AddContact.razor
/Pages/Contacts/EditContact.razor

nesting the 3 pages in a folder would cut down on the files in the pages folder and group the code and pages by the name of the table / entity. and the routing could use a variation of this that i think might work well with the ideas of Restful paths
/Contacts - routes to Contacts.razor
/Contacts/Add routes to Contacts/AddContact.razor
/Contacts/Contact?ID=29 routes to Contacts/EditContact.razor passing the parameter of the ID to the page.

this would start to have the URL's follow a rest pattern and allow for bookmarks and links that can be saved when needed or shared when needed.....

i can still see things that a developer will need to handle but i think this might help as an application that has a lot of tables and pages needs to be managed.

1 Like