Everything You Need To Know About Blazor in .NET 8

  Рет қаралды 11,213

Codewrinkles

Codewrinkles

Күн бұрын

Blazor in .NET 8 has fundamentally changed! It's not about just some fancy new stuff, it's a whole new programming model that will require from us as developers to adjust accordingly. However, worry not, because in this video I have put together all the bits and pieces that you need to be aware of in Blazor in .NET 8. The video covers the new rendering models starting from SSR (static server rendering) and the different ways we can add interactivity to Blazor apps. Last but not least I'll show you the exciting new things regarding authentication in Blazor in .NET 8.
#dotnet #blazor #aspnetcore
Join this channel to get source code access and other perks:
/ @codewrinkles
Content
1. Intro: 00:00
2. Hosting models in previous Blazor: 00:29
3. New Blazor render modes: 01:14
4. Blazor SSR is the new default: 01:29
5. New Blazor setup overview: 04:10
6. Blazor SSR in action: 05:44
7. Blazor Interactive Server Mode: 07:45
8. Blazor Streaming Rendering: 08:32
9. Blazor Interactive WebAssembly Mode: 10:42
10. Blazor Interactive Auto Mode: 13:31
11. The Good, The Bad, The Ugly: 14:44
12. Authentication in the new Blazor: 18:08

Пікірлер: 66
@valterleimuryviana7697
@valterleimuryviana7697 Ай бұрын
The best explanation about Blazor on the web that I think too! Congrats!
@troom6851
@troom6851 2 ай бұрын
The best explanation of blazor in .NET8 I've found on the internet. Congratulations and thank you, I will definitely watch the whole series.
@chairmakerPete
@chairmakerPete 7 ай бұрын
Spot-on with the WASM comments! Two projects to save the user a few microseconds of pain at initial load is hard to justify for most scenarios, but it's great to see Microsoft putting so much resource and developments into Blazor. The Auto mode is great to see, but not viable in production, IMHO. Suspect it'll be iterated down to having a single project in future releases. For me it'll be Server mode all the way, and Razor components shoving cshtml aside is another nice tidying up exercise. I have one MVC site in maintenance, and I think that'll be replaced with SSR for the most part, so at long last I can leave WebForms and MVC and focus on one framework. Great video - thank you!
@Codewrinkles
@Codewrinkles 7 ай бұрын
Thanks for watching and for your kind words.
@SmoothNanners
@SmoothNanners 7 ай бұрын
One thing that would be cool to see added to Blazor is something like asp-append-version where it appends a hash in a query string for cache-busting of assets in script and link tags.
@broadshare
@broadshare 7 ай бұрын
I am thinking of using only SSR going forward, the old school way the way everything worked over the years
@Codewrinkles
@Codewrinkles 7 ай бұрын
I'm thinking the same way. Not sure however what the cons are in real production apps yest. I guess time will tell.
@tanveerhasan2382
@tanveerhasan2382 7 ай бұрын
so it seems, so it seems
@XXnickles
@XXnickles 7 ай бұрын
I am going to agree with something here: webassembly is not looking good in the programing model. To be honest I like what they have done with Blazor as it simplifies a lot of code that needed an RPC "API", but the webassembly part is becoming crumble some unless you go to full SPA (the same can be say for the server side interactivity) I am seeing things like HTMX as the real companion to the updated programing model, especially now we can render blazor components "anywhere" and deliver them through minimal API. Personally, I am moving an SPA webassembly to server side to webassembly interactivity and so far, I find it simpler than having an RPC API for everything. Definitely going to try HTMX in the mix at some point, perhaps I can end diching webassembly...which will be funny as it was the part that brought the most interest to blazor
@Codewrinkles
@Codewrinkles 7 ай бұрын
HTMX is definitely something that I will also take a look at.Thanks for sharing!
@dustee2680
@dustee2680 7 ай бұрын
How do you use blazor and htmx both? For htmx isnt all you need: razor page, the new render function and a minimal api?
@XXnickles
@XXnickles 7 ай бұрын
@@dustee2680 I am in initial phases of playing with that stack. I am using blazor SSR, minimal api and the rendering function they introduced in net 8. The idea of the api is respond with rendered blazor components (html) instead of json. Still you need to use js for interactivity and you need to rely in standard HTML forms for data and validation
@parko1965
@parko1965 6 ай бұрын
That's interesting, I wondered why the Hosted Wasm Template was removed from VS. Years ago I was told to stick with HTML/Javascript/CSS as the only 3 topics I would ever need to study to become a successful developer. I wish I'd listened.
@bartlomiejuminski
@bartlomiejuminski 7 ай бұрын
Well explained. Than You
@Codewrinkles
@Codewrinkles 7 ай бұрын
My pleasure
@Programs4RScash
@Programs4RScash 7 ай бұрын
Not really he's causing more confusion with his answers because he's not experienced with anything but the Blazor Server. He doesn't even know the difference between a template and a hosting model.
@Codewrinkles
@Codewrinkles 7 ай бұрын
Lol :))
@alfonsdeda8912
@alfonsdeda8912 5 ай бұрын
Hi, my questions are: -SSR is the new default mode for blazor apps, so the old server mode interactivity should be used only when I need interactivity and don't want to download code in the client? -the auto mode should be used always, I mean it has the best world of all two old modes, or should be used when there is at least a component with interactivity? Should I always start with the automode project that create two different projects? -should I choose automode over old blazor server mode even there isn't interactivity? Thanks in advance.
@Barto2You
@Barto2You 7 ай бұрын
Hey thx again for your video. One question regarding the authentication: Is there a reason why the authetication type Windows is missing in the new template?
@Codewrinkles
@Codewrinkles 7 ай бұрын
I'm not sure about that. Tbh there's only the individual user accounts there. I think one possible explanation would be that auth actually behaves exactly like in regular MVC apps.
@flatproject298
@flatproject298 6 ай бұрын
It would be great to see how you can have multiple constructors in the dbcontext and use adddbcontextfactory. At the moment it says you cant have multiple constructors when adding migrations.... But it works with adddbcontext()
@goverdhanjayaram3683
@goverdhanjayaram3683 7 ай бұрын
Thank you very much for your efforts !
@Tamer_Ali
@Tamer_Ali 7 ай бұрын
Thanks Mr.Dan. I hope you talk about blazor wasm self hosting in your upcoming videos which doesn't exist anymore
@Codewrinkles
@Codewrinkles 7 ай бұрын
Blazor WASM and Blazor Server still exist in .NET 8. So, if you want you can still create projects using old hosting model. But I would stronglt advise against it, ast the new Blazor seems to be the main focus on Microsoft right now and probably the older hosting models will get less attention in the future.
@Programs4RScash
@Programs4RScash 7 ай бұрын
@@Codewrinkles You don't even know the difference between a template and a hosting model. Stop advising.
@Codewrinkles
@Codewrinkles 7 ай бұрын
Once again, lol :)) I think you're the ignorant one here.
@paulgehrman
@paulgehrman 7 ай бұрын
@@Codewrinkles I agree that the "new" Blazor will likely be Microsoft's focus, but I'm still not convinced that a pure wasm solution doesn't make sense in some scenarios - LOB apps, for example. I had really good luck with wasm in .net 5/6, so it is somewhat disheartening to see that perhaps the wasm model is either being deprecated or shunned. I also agree with you that mixing render modes and adding a second project seems less than ideal, to say the least.
@E_G_
@E_G_ 7 ай бұрын
Great explanation thank you 🙏🏻
@Codewrinkles
@Codewrinkles 7 ай бұрын
Glad you liked it
@wahebbenzaid543
@wahebbenzaid543 7 ай бұрын
As a beginner in Blazor, should I start by learning Blazor web assembly or Blazorserver or what exactly ? thank you
@Codewrinkles
@Codewrinkles 7 ай бұрын
If you start right now, I feel you should start with the new Blazor model in .NET 8 which is based on the SSR idea.
@parko1965
@parko1965 6 ай бұрын
For me too many changes to what I thought was a solid foundation developers could build on. With the way Blazor is going the learning time outweighs actual productivity time. With the likes of Angular this is not the case, new functionalities are a subtle introduction. However I think I'll stick with the API/Blazor Wasm model for the time being until I can afford the time to re-learn Blazor for what it is now.
@rorysanchez
@rorysanchez 7 ай бұрын
I am a bit confused with the identity feature. So far I’ve used azure aadb2c in my .net 7 blazor apps. Am I supposed to use this new identity components? Do they connect to aadb2c? Or should keep using b2c as usual? What is the difference here? If you could elaborate a bit i’d appreciate it, i’m quite confused. Thanks a lot!
@Codewrinkles
@Codewrinkles 7 ай бұрын
I will do more videos on auth. The idea is essentially that you would connect to Azure AD B2C exactly the same way you would connect in a regular Asp.Net MVC app or Razor Pages app.
@armandob5571
@armandob5571 6 ай бұрын
@@Codewrinkles would love to see a "How to implement authentication in Blazor Server from scratch" for Blazor 8
@adbirdk
@adbirdk 7 ай бұрын
First off, thank you very much for your videos. Is there any chance I can get you to figure out or tell us how we can add dynamic content to the PageTitle in Dotnet8? Adding something like in forecasts.Count() or int Count() => return forecasts.Count(); does not update the PageTitle. I tried adding @rendermode="InteractiveServer" to the pagetitle component, but it must be a different rendermode I need to add there. Any hints, tips or insight? It seems like this breaks what we could do i .net7.
@Codewrinkles
@Codewrinkles 7 ай бұрын
To be honest I don't think you can place Dynamic content there. But I will try it out and see if I can get around it.
@kis.stupid
@kis.stupid 7 ай бұрын
The is responsible for interactivity on the head tags. Not the PageTitle component.
@adbirdk
@adbirdk 7 ай бұрын
@@kis.stupid Excellent! Thank you, this was what I was missing.
@adbirdk
@adbirdk 7 ай бұрын
@@Codewrinkles as kis.stupid said: add @render-mode="InteractiveServer" to in app.razor and it works as in .net 7. I was close with adding it to pagetitle 😅
@Codewrinkles
@Codewrinkles 7 ай бұрын
Thanks for sharing this!
@majormartintibor
@majormartintibor 7 ай бұрын
thanks for sharing!
@Codewrinkles
@Codewrinkles 7 ай бұрын
My pleasure
@travelingsober
@travelingsober 6 ай бұрын
But if the component are interactive server then the httpcontext can't be accessed. Correct?
@Codewrinkles
@Codewrinkles 6 ай бұрын
Well, it can be accessed, but it might be null or have oudated information. The core idea, I believe, is to access the HttpContext only in SSR components and in as few occasions as possible.
@travelingsober
@travelingsober 6 ай бұрын
@@Codewrinkles Yes, this seems to be the case. Ugghh. Thanks.
@Tamer_Ali
@Tamer_Ali 7 ай бұрын
What do you recommend for e-commerce website, Wasm or Server ?
@Codewrinkles
@Codewrinkles 7 ай бұрын
It depends on a lot of thing. Is it a personal project or a customer project? Does the customer already have an API for their shop?
@Tamer_Ali
@Tamer_Ali 7 ай бұрын
@@Codewrinkles it's a customer project and they have no api because it's a new project
@Codewrinkles
@Codewrinkles 7 ай бұрын
And what is the estimate usage of the app? An average of users per second, how often would peeks occurr? In peek times how many users per second would use the app?
@Tamer_Ali
@Tamer_Ali 7 ай бұрын
@@Codewrinkles about 1000 or more
@Codewrinkles
@Codewrinkles 7 ай бұрын
I'd probably go for Blazor WebAssembly in this case.
@JtendraShahani
@JtendraShahani 7 ай бұрын
I am actualy getting an error on @rendermode. It says ' Cannot resolve symbol 'rendermode' '
@Codewrinkles
@Codewrinkles 7 ай бұрын
I think you are placing components in a folder different than the "Components" default folder. Notice that you have an _Imports.razor in the Components folder. You need to also add in your components folder. Obviously also copy over the contents of the original _imports.razor.
@JtendraShahani
@JtendraShahani 7 ай бұрын
@Codewrinkles This is a known issue for those who use ReSharper
@IvanRandomDude
@IvanRandomDude 7 ай бұрын
Seems like poor attempt to replicate NextJS. Not sure if I like it or not tbh.
@Codewrinkles
@Codewrinkles 7 ай бұрын
I'm not sure it's about replicating NextJs. I've worked with the NextJS appRouter and I agree that adding interactivity there is much easier with just "use-client". On the other side I think that the Interactive Server Mode is a winner for Blazor, because it makes things more secure and easier to process on the backend without the need of an API. Also the StreamRendering is definitely a winner and something that's not there in NextJs.
@IvanRandomDude
@IvanRandomDude 7 ай бұрын
@@Codewrinkles I am probably missing something. I thought Suspense in NextJS serves the same purpose as StreamRendering. At least they seem to be accomplishing the same thing.
@Codewrinkles
@Codewrinkles 7 ай бұрын
Actually you're right about Suspense
@BushraAkhtar-ed1hz
@BushraAkhtar-ed1hz 5 ай бұрын
A newbie can never understand what you are telling in your videos....i wish the youtube instructors teach in a simple way that a newbiew could understand what is going on
@Codewrinkles
@Codewrinkles 5 ай бұрын
I have plenty of videos (and entire playlists) that contain only content tailored for absolute beginners. This one is certainly not one of it. I'm sorry this video didn't match your expectations. I'll try to improve in future videos.
Smart Sigma Kid #funny #sigma #comedy
00:25
CRAZY GREAPA
Рет қаралды 5 МЛН
Неприятная Встреча На Мосту - Полярная звезда #shorts
00:59
Полярная звезда - Kuzey Yıldızı
Рет қаралды 7 МЛН
Must-have gadget for every toilet! 🤩 #gadget
00:27
GiGaZoom
Рет қаралды 11 МЛН
Ten Amazing Blazor Features You Must Know
25:34
Gavin Lon
Рет қаралды 5 М.
What is the Future of Blazor? Should I Learn Blazor?
22:32
IAmTimCorey
Рет қаралды 55 М.
.NET 8 | Everything you NEED to KNOW!
9:04
Claudio Bernasconi
Рет қаралды 24 М.
Blazor: Why 2024 Is The Year Of Blazor 🚀
9:40
Coder Foundry
Рет қаралды 23 М.
Blazor Server Side Rendering in .NET 8.0 - A Quick Look
10:39
The Code Wolf
Рет қаралды 6 М.
Starting .NET MAUI Development in 2024 - What You Need To Know
35:18
James Montemagno
Рет қаралды 54 М.
How To Add Google Authentication To Blazor SSR
24:23
Codewrinkles
Рет қаралды 2,8 М.
htmx in 100 seconds
2:27
Fireship
Рет қаралды 1,1 МЛН
What’s new in Angular v18
20:08
Angular
Рет қаралды 99 М.
Собери ПК и Получи 10,000₽
1:00
build monsters
Рет қаралды 1,7 МЛН
Main filter..
0:15
CikoYt
Рет қаралды 12 МЛН