Blazor's New Web App Template🔥, Deepen Your Repository Pattern Knowledge🚀


Hey Reader,

The recent release of .NET 8's RC1 brought us an exciting Blazor Web App Template that combines both Blazor Server and WebAssembly in a single project. In my latest video, I dive into this template, highlighting the new render modes of Blazor in .NET 8.

video preview

Additionally, I wanted to share an intriguing Q&A from our .NET Web Academy Community this week about enhancing repositories as applications grow. Paolo asked:

"Hi Patrick, sometimes it is necessary to work on several Domain Entities at the same time and the single-entity CRUD offered by Repositories is not sufficient. Thinking of combining in a 2nd level Repository, which uses single-entity repositories is sometimes not possible and often creates a performance decay. What is your suggestion?"

My response:

"Hi Paolo,

Thank you for your insightful question. As our applications grow, it’s essential to address architectural concerns to balance flexibility, maintainability, and performance. Let’s dive deeper into the solutions with a mix of simple theoretical insight and code examples tailored to our .NET Web Academy’s project.

Aggregate Roots:

Think of an Aggregate Root as a main item that groups related things together. By working with this main item, we can easily manage the related items without messing things up.

Example: In our TimeTracker, a Project can be seen as the main item that has linked TimeEntry and ProjectDetails. So, if we want to make changes to a TimeEntry for a project, we go through the Project.

Specification Pattern:

This is a way to set rules for fetching specific items from our data. It’s super useful when we have a lot of rules!

Example: Instead of multiple methods to get data, we use rules. Like one that fetches all time entries for a project.

UnitOfWork Pattern:

It’s like a safety net. When we have multiple changes to save, it ensures all changes are saved correctly or none at all.

Example: If we’re updating a Project and its TimeEntry, this ensures both updates are done right.

Performance Tips:

As our app grows, it’s important to fetch data quickly. There are ways to do this effectively.

Example: Using Entity Framework, we can fetch a Project and its TimeEntries together, which is faster.

Custom Repositories:

Sometimes, we need special methods to get or update our data.

Example: A method that gets a Project, its TimeEntries, and ProjectDetails all together.

In short, as we handle more data, we might need to mix and match different techniques to make things easier and faster. Your question helps us all think deeper about these challenges."

📩 Have a burning question or a topic on your mind? Simply hit 'reply' and send it my way. I genuinely appreciate your feedback and ensure I read every message.

Until next time, happy coding! 💻

Take care,

Patrick


Patrick God

Become a .NET & Blazor expert with weekly tutorials featuring best practices and the latest improvements, right in your inbox.

Read more from Patrick God
video preview

Hey Reader, If you’re a Blazor developer, you know that annoying flash when your app loads data during pre-rendering. It’s been around forever. Sure, you could disable pre-rendering, but then you'd hurt performance and SEO. Well… with .NET 10, we finally have a real fix: the new Persistent State Attribute. 🎉 🎥 Watch my full tutorial about it here: In this video, I walk you through: ✅ What causes the flashing issue ✅ Why disabling pre-rendering isn’t ideal ✅ How the new Persistent State...

Hey Reader, Last week, I tested GPT-5 Agent Mode on .NET and Blazor apps, and the results were surprising. This week, I went a step further. I used GitHub Copilot inside Visual Studio and asked it to create real .NET and Blazor projects for me. Here’s what happened: Copilot generated a working calculator app in C#. It built a Web API that responded with “Hello GPT-5 Agents.” It even created a Blazor app with extra features like a reset button, a plus five counter, and a weather API. Were...

video preview

Hey Reader, I just published a new video where I put GPT-5’s Agent Mode to the test. 🚀 Instead of asking it for something simple, I went all in: A .NET 9 console app calculator A Web API with endpoints and docs A Blazor Server app with extra counter buttons And even a Blazor app that calls a public weather API 🎥 Watch it now: In the video, I didn’t just type “make me an app” and hope for the best. I gave GPT-5 very specific prompts, like: “Please create a .NET 9 console application that works...