Dear Community
I'm starting a new project, and we are thinking about using blazor.
It's the first time for me that I use it so before working with any technology I always want to get feedbacks from the experts :).
When I started to go through a small project written in blazor I noticed the following point :
I found in some .razor samples that xml is mixed with the C# code in the same file.
It reminded me the Asp way where everything was mixed in one file without having any code behind or viewModel ...
So my questions are :
1- what's the advantage of a such implementation ?
2- how can we ensure the seperation of concerns with this implementation ?
3- How easy will be the implementation of unit tests for the .razor files ?
The project is a classical one with backend and frontEnd. What are the advantages of blazor compared to other front end technologies
Thanks

Nitin SontakkePosted Aug 23, 2022, 12:34 PM
Aymen AmriPosted Aug 24, 2022, 7:56 AM
Hi Sam
In fact, yes our solution is strongly linked to business. It handles purchase transactions, sale transactions account management ....
So you're raising an important point and we need to consider it in our choice.
Nitin SontakkePosted Aug 24, 2022, 5:51 AM
Sam HobbsPosted Aug 23, 2022, 10:23 PM
An important point that I do not see mentioned yet is that Blazor WebAssembly is a single-page app (SPA) framework. A SPA can be very useful but not for everything. Blazor WebAssembly is good for static websites. Blazor WebAssembly can be a mistake for businesses; database access is either insecure or requires more complicated solutiions. See the following.
ASP.NET Core Blazor hosting models | Microsoft Docs
https://docs.microsoft.com/en-us/aspnet/core/blazor/hosting-models?view=aspnetcore-6.0#blazor-webassembly
ASP.NET Core Blazor | Microsoft Docs
https://docs.microsoft.com/en-us/aspnet/core/blazor/?view=aspnetcore-6.0
c# - How do you create a Blazor WebAssembly website connected to a database with CRUD functions - Stack Overflow
https://stackoverflow.com/questions/68360161/how-do-you-create-a-blazor-webassembly-website-connected-to-a-database-with-crud
c# - How to connect Blazor WebAssembly to DataBase - Stack Overflow
https://stackoverflow.com/questions/63996294/how-to-connect-blazor-webassembly-to-database
For a business, ASP.Net Core with MVC or Razor Pages might be a better solution. It might take more time to create intitally but might be a better solution for the future.
I am only beginning to learn any of those; I do not claim to be an expert. I am basing what I am saying on what many professional web developers use.
I am reading the book Pro ASP.NET Core 6 by Adam Freeman.
Aymen AmriPosted Aug 23, 2022, 2:48 PM
Sachin SinghPosted Aug 23, 2022, 2:11 PM