Data Driven Layout in Server-side Blazor

in C# Blazor Razor Components

One thing I stumbled on with Blazor was how to create a layout that changed based on the data on the page. For example, you may want to include bread crumbs in the header of your page. You could get the URL and try to parse out where in the application from your MainLayout, and then figure out what you need to figure out to create your breadcrumbs. But ideally you’d have each page figure out it’s own breadcrumbs and pass that data to the header.

Continue Reading

Dependency Injection Lifetimes in Blazor

in C# Blazor Razor Components

I’ve been playing with Server-side Blazor for a few days and I’ve been really impressed. I can see that this will be an immensely powerful technology and I hope to make it my main web platform going forward. But it’s model does change some things. Since you’re running the app on the server and just using SignalR to update the browser’s UI it changes the lifetime of Scoped objects in Asp.Net’s dependency injection.

Continue Reading

Removing Items From a List

in C#

It’s not at all uncommon to need to iterate through a List to remove an item. And about half the time when I do so I get a “Collection was modified; enumeration operation may not execute.” exception the first time I run the code. Then I do something fancy like use a for loop to iterate through the list backward and remove the items from the list. Something like this:

Continue Reading

Working Remote

in Random

One of my coworkers will be moving and switching to working remotely. He asked me to share my thoughts about working remote and it turns out I have a lot. Hopefully, they are worth sharing.

I’ve been remote for 4 years now as an employee, and also worked remotely for about 7 years while as an independent consultant. The consulting was more solo work and less teamwork and was much more isolating, but it did help me form some boundaries around working from home. At this point, I hope never to work in an office again. Here’s what I think are the keys to being happy working from home:

Continue Reading