Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use subfolders in the Pages and Shared folders

I've got a Blazor Server-Side application. It has the folders Pages and Shared out-of-the-box. Since I have a lot of components in these folders, I wanted to distribute the components into multiple subfolders for a clearer structure. But if I do this, the components are not found and are not displayed in the GUI. What am I missing? Do I have to register the routes to the new subfolders somewhere?

like image 874
Pascal R. Avatar asked Jul 19 '19 12:07

Pascal R.


People also ask

What is the main use of folders and subfolders?

Folders help you keep your files organized and separate. If you had no folders on your computer, your documents, programs, and operating system files would all be located in the same place. Folders also allow you to have more than one file with the same file name. For instance, you can have a file called Resume.

What is the difference between folders and sub folders?

Answer. Answer: is that subfolder is (computing) a folder within another folder while folder is (computing) a virtual container in a computer's file system, in which files and other folders may be stored the files and subfolders in a folder are usually related.

How do I add a subfolder to multiple folders?

Simply hold down the Shift key and click with the right mouse button in the Explorer on the folder where you want to create additional subfolders.


1 Answers

You can have whatever folder structure you wish. But you will need to update your _Imports.razor with the new namespaces.

For example if you have a structure of

MyProject/Components/Forms/MyInput.razor

You would need the following in your _Imports.razor:

@using MyProject.Components.Forms;

The other option is to reference components using their fully qualified namespace:

<MyProject.Components.Forms.MyInput/>
like image 89
Chris Sainty Avatar answered Sep 17 '22 19:09

Chris Sainty