The .NET Stacks #6: Blazor mobile bindings, EF update, ASP.NET Core A-Z, more!

This is an archive of my weekly (free!) newsletter, The .NET Stacks. Consider subscribing today to get this content right away! Subscribers don’t have to wait a week to receive the content.

On tap this week:

  • Mobile Blazor bindings
  • More Entity Framework updates (get your questions in)!
  • Dev Discussions: Shahed Chowdhuri
  • Community roundup

Mobile Blazor bindings

In this week’s ASP.NET community standup, Jon Galloway talked with Eilon Lipton about his experimental Mobile Blazor Bindings project. The project has been out in experimental mode for a while and, as Eilon said in the standup, looks to be slated for general public consumption by the end of July or so.

So, what is Mobile Blazor Bindings? (We’ll call it MBB from now on.) MBB allows you to write native, cross-platform mobile applications using the Blazor programming model. (If you don’t know Blazor yet, it’s a new ASP.NET Core technology which allows you to write C# across the stack, in most cases replacing JavaScript.) This allows you to use Blazor with Razor markup, as an alternative to the Xamarin.Forms XAML model, which might be foreign to many web developers. In February, Dylan Berry wrote about how he was able to port over a Xamarin.Forms MVVM screen, which was 188 lines - and was only 68 lines with the MBB model.

Based on the success of this project so far, a natural question to ask is what this says for the fate of Xamarin. Based on Microsoft’s past communications on MBB, this is messaged as an option. In other words: you do you. If you like to write mobile apps using XAML, continue doing that! If you’re a fan of Razor syntax and features (and the Blazor model), this is an option for you. As someone who enjoys the latter and is allergic to XAML (despite what my doctor says), it’s a big selling point for me, as it makes the barrier to entry a lot easier if you want to dip your toes into mobile app development.

For more details, check out the GitHub repo.

More Entity Framework updates (get your questions in!)

A few weeks ago, we checked in on EF Core. As things evolve quickly, and with this week’s release of EF Core 5 Preview 6, there’s still more to discuss! This release includes a lot of requested functionality, including split queries for related collections, an IndexAttribute annotation, improved query translation exceptions, IPAddress mapping, and more.

Split queries is a big one. Until this release, EF Core generates a single SQL query for any LINQ query, even when you use .Include or a projection type that returns you multiple related collections. While it ensures consistency, it can be slow-performing.

Now, you can leverage the AsSplitQuery() API. Let’s say you have a Blogger entity, which has Posts and then Tags. Now, this would be split into three different queries: one to get the blogger (by ID, likely), one to get all Posts for the blogger using an inner join on Blogger, and a third to get Tags, with joins on the Blogger and the Post.

This new feature supports all operations, including OrderBy, Skip, Take, Join, and FirstOrDefault. Take a look at the release announcement for details.

Also, I’m excited to say I have a .NET Stacks interview set up with Jeremy Likness, the Senior PM for .NET Data at Microsoft! If you have any questions about Entity Framework, or any data-related .NET stuff, let me know this week and I will forward it to him.

Dev discussions: Shahed Chowdhuri

As a huge fan of the Marvel universe, Microsoft’s Shahed Chowdhuri must feel like Captain America after publishing the last post of his ASP.NET Core A-Z blog series this week. In these posts, he wrote 26 ASP.NET Core posts in 26 weeks, from A-Z (Authentication & Authorization to Zero-Downtime Web Apps). This was all using a single sample project!

I talked with Shahed about his path to Microsoft, the evolution of the blog series, his side projects and interests and, of course, which Marvel character sums him up best. You can reach out to Shahed on Twitter and follow his site, Wake Up and Code.

What got you into software development, and Microsoft? What are you doing for Microsoft these days?

Although I took two and a half years to complete a four-year degree in Civil and Environmental Engineering, I also taught myself how to build websites and software applications while in college. I worked on my personal website and also additional websites for the Civil Engineering department, the International Students Association, and my dorm.

I realized that I could build something, see results instantly, fix issues, and then see my changes right away. I got an internship as a web application developer during my second (and final) summer vacation, and then got a full-time job offer upon graduation.

I joined Microsoft as a Tech Evangelist 6+ years ago, as I was already using my spare time for public speaking on various topics. My role has changed in recent years, and I’m currently working with our enterprise customers to collaborate on software development projects and solve real-world business problems.

What made you take on the original ASP.NET Core A-Z blog series in 2019?

In the fall of 2018, I was helping a colleague with some .NET code for a customer project (file upload into Azure Blob Storage) during a company hackathon. Instead of emailing him the code sample with an explanation, I decided to write a blog post and publish the code in a GitHub repository. To lead into this blog post, I also worked on a “Hello World” article, that was appropriately titled “Hello, ASP.NET Core!” so that I could help new developers get started with ASP.NET Core.

As a result, this was the birth of a mini series to end 2018 with a bang. Over a span of 12 weeks from October to December 2018, I published these seemingly randomly-selected topics on ASP.NET Core. Eventually, I revealed the hidden message “HAPPY NEW YEAR” just before the new year. Knowing that I couldn’t pull off the same trick twice, I decided go with a new series in 2019.

There are 52 weeks in a year, 26 weeks in half a year. This was the perfect opportunity to cover 26 different topics from A-Z in 2019, since there are also 26 letters in the alphabet.

As you kicked off a new version of the series with an approach to feature everything in a single project, did you come across anything unexpected or interesting?

Before 2019, I wasn’t sure if I could pick a topic for each letter if I stuck to ASP.NET Core. I was debating whether I should cover HoloLens, Bot Framework, Machine Learning and various other topics throughout the series. But I narrowed it down to topics that would be relevant to an ASP.NET Core developer, and also reviewed my list with Jon Galloway.

The 2019 series included code snippets that were all over the place. For the 2020 series, I decided to start with a real-world open-source web app (NetLearner) and build upon it week after week. I made sure that the web app included similar functionality across multiple web projects (MVC, Razor Pages, Blazor) with a shared library for core/infrastructure code.

What is your one piece of programming advice?

One piece of advice I would give anyone is to always keep learning. That doesn’t necessarily mean that you should learn every new programming language or framework that pops up on your radar. It could mean that you may want to dig deeper into a language you’ve already been working with. It could be some business skills that you want to pick up, to run your own software business or work as a consultant to help others run theirs.

This is only an excerpt of my talk with Shahed. Read the full interview over at my website, especially if you like Baby Groot from the Guardians of the Galaxy movies.

Community roundup

From Microsoft

Blog posts

Podcasts/videos

New subscribers and feedback

Has this email been forwarded to you? Welcome! I’d love for you to subscribe and join the community. I promise to guard your email address with my life.

I would love to hear any feedback you have for The .NET Stacks! My goal is to make this the one-stop shop for weekly updates on developing in the .NET ecosystem, so I look forward to any feedback you can provide. You can directly reply to this email, or talk to me on Twitter as well. See you next week!