|
| 1 | +# Fronts |
| 2 | + |
| 3 | +## Using Blazor |
| 4 | + |
| 5 | +### Why Blazor ? |
| 6 | + |
| 7 | +Blazor can run your client-side C# code directly in the browser, using WebAssembly. Because it's real .NET running on WebAssembly, you can re-use code and libraries from server-side parts of your application. (https://dotnet.microsoft.com/apps/aspnet/web-apps/blazor) |
| 8 | + |
| 9 | +### Prerequisites |
| 10 | + |
| 11 | +https://dotnet.microsoft.com/download/dotnet/5.0 |
| 12 | + |
| 13 | +### Generate your application |
| 14 | + |
| 15 | +Call the generator |
| 16 | + |
| 17 | +```bash |
| 18 | +jhipster --blueprints dotnetcore |
| 19 | +``` |
| 20 | + |
| 21 | +and choose Blazor (WebAssembly) |
| 22 | + |
| 23 | + |
| 24 | + |
| 25 | +After that, your application is ready, and you can now use it with default user (admin admin or user user) |
| 26 | + |
| 27 | +You can run the Backend with |
| 28 | + |
| 29 | +```bash |
| 30 | +dotnet run --verbosity normal --project ./src/YourAppName/YourAppName.csproj |
| 31 | +``` |
| 32 | + |
| 33 | +And you can run the Frontend with |
| 34 | + |
| 35 | +```bash |
| 36 | +dotnet run --verbosity normal --project ./src/client/YourAppName.Client/YourAppName.Client.csproj |
| 37 | +``` |
| 38 | + |
| 39 | +You can also use the **hotreload** |
| 40 | + |
| 41 | +For the backend |
| 42 | +```bash |
| 43 | + dotnet watch --project ./src/YourAppName/YourAppName.csproj run --verbosity normal |
| 44 | + ``` |
| 45 | + For the frontend |
| 46 | +```bash |
| 47 | + dotnet watch --project ./src/client/YourAppName.Client/YourAppName.Client.csproj run --verbosity normal |
| 48 | + ``` |
| 49 | + |
| 50 | +### Generate entities |
| 51 | + |
| 52 | +Like the others front technologies you can generate entities for blazor |
| 53 | + |
| 54 | +With cli |
| 55 | +```bash |
| 56 | +jhipster entity <entity-name> |
| 57 | +``` |
| 58 | + |
| 59 | +or with jdl (https://start.jhipster.tech/jdl-studio/) |
| 60 | +```bash |
| 61 | +jhipster import-jdl my_file.jdl |
| 62 | +``` |
| 63 | + |
| 64 | +### Tools |
| 65 | + |
| 66 | +As the project used SASS, to install and consume scss third parties libraries like bootstrap we use Microsoft Library Manager (aka [libman](https://github.com/aspnet/LibraryManager)) |
| 67 | +You can find libman configuration in same directory than client solution (./src/client/YourAppName.Client) |
| 68 | + |
| 69 | +To minify css we use Excubo.WebCompiler (aka [webcompiler](https://github.com/excubo-ag/WebCompiler)) |
| 70 | + |
| 71 | +These two tools are installed during jhipster client generation, and you can find the execution in client csproj (./src/client/YourAppName.Client/YourAppName.Client.csproj) |
| 72 | + |
| 73 | +### UI components |
| 74 | + |
| 75 | +To speed up our development we use [Blazored](https://github.com/Blazored) components like Blazored.Modal or Blazored.SessionStorage. |
| 76 | + |
| 77 | +We also use [Blazorise](https://github.com/stsrki/Blazorise) which has really interesting components. |
| 78 | + |
| 79 | +### UT |
| 80 | + |
| 81 | +For unit test we use the awesome library [bUnit](https://github.com/egil/bUnit). |
| 82 | + |
| 83 | +You can find client unit test in ./test/YourAppName.Client.Test |
| 84 | + |
| 85 | +### Limitations |
| 86 | + |
| 87 | +For the moment, the Blazor generation has certain limitations : |
| 88 | + |
| 89 | +- Only support DTO you can't use application without DTO |
| 90 | +- No validation on entity fields (The validation is only on user management part) |
| 91 | +- No translation |
| 92 | +- Only JWT security is implemented |
0 commit comments