Hey Reader,
This week we're diving deep into Blazor via .NET 8, focusing on mastering CRUD operations using the fresh render modes—Auto, Server, WebAssembly, and even no render mode for static server-side rendering via stream rendering. Yep, that's a mouthful of new capabilities for you!
No sweat, I've got you sorted. This week's video walks you through each render mode and demonstrates how to flawlessly execute CRUD operations, complete with persistence via Entity Framework and SQL Server Express.
If you're more of a code-first person, here's a sneak peek at the essential code sections. With the latest Blazor Web App template in Visual Studio 2022 Preview, selecting Auto or WebAssembly render modes gifts you two projects—Server and Client. The Server project comes fully equipped for Web API tasks, including the ability to add API controllers, which is vital for using server-side services in your client project.
Say you've crafted a simple game library entity:
Along with the requisite Entity Framework boilerplate:
Watch Your Steps!
Have you set all this up in the Server project? Ah, but what if you need to access your Game Entity or services from the Client project? To solve this, I shifted everything to a separate Class Library:
You'll notice that this setup closely resembles the older Blazor WebAssembly ASP.NET Core Hosted template from .NET 7.
To call server logic from your client app, web service calls are still the way to go. Dependency Injection comes to the rescue, allowing us to implement the IGameService interface differently for the client:
Remember to register your GameService and HttpClient on both client and server ends.
Client:
Server:
And, of course, don't forget the new controller on the server:
I get it; this might feel overwhelming at first. But trust me, once you get your bearings, the new .NET 8 features will feel like second nature. I'm also working on a video that compares the .NET 7 and .NET 8 versions of a Blazor WebAssembly app. So stay tuned!
To grab the complete code, watch the video or head to my Patreon page for the repo download.
💌 Got questions or topics you're curious about? Just hit 'reply'—your input is priceless. A massive shoutout to everyone for making this community what it is! 🙌 Special thanks to my Patrons—your support fuels this newsletter and my YouTube channel.
Until our next coding journey, stay well and happy coding! 💻
Patrick
Become a .NET & Blazor expert with weekly tutorials featuring best practices and the latest improvements, right in your inbox.
Hey friend, A year ago, I said AI coding tools weren't the future. I want to correct that. The distinction I missed: there's a real difference between vibe coding (copy-paste until it compiles, no understanding required) and skilled AI-assisted development (you own the architecture, AI implements it, you review the output). I was criticizing the first and accidentally dismissing the second. In 2026, skilled AI-assisted development is the professional standard. Not using these tools is now a...
Hey friend, We once spent five days in meetings debating a single delete button. Whiteboard sessions. A compliance guy nobody invited. A product manager who scrolled Slack for what felt like forever. And still no decision. Until Tom walked in on Monday morning, asked one question, and shipped it that afternoon. In this video, I tell the full story and walk you through the four questions that should end this debate on any team, in any codebase. Take care, Patrick P.S. We go deeper on exactly...
Hey friend, Most developers use AI the same way: send a prompt, wait, repeat. It works. But it's slow. And it leaves a lot on the table. In today's video, I show you the workflow I switched to: running multiple Copilot agents in parallel, each working on a different part of the app at the same time. It feels less like using a tool and more like managing a team. And with vertical slice architecture, it just clicks. Take care, Patrick P.S. Want to set this up for your own projects or team? I'm...