The .NET Stacks #36: ⚡ Azure Functions and some Microsoft history
This week, we talk about Azure Functions, Blazor, and some Microsoft history.
Welcome to another week. If you’re seeing temperatures above above 0° F, please send some my way. Talk about a cold start—Azure Functions should be jealous.
This week:
- OpenAPI support for Azure Functions
- Achieving inheritance with Blazor CSS isolation
- Ignoring calls from Bill Gates
Open API support for Azure Functions
When you create a new ASP.NET Core Web API in .NET 5, you may have noticed that Open API (more commonly to you, Swagger UI) is supported out of the box—and there’s a handy check mark in Visual Studio to guide you along. You might be wondering: will Open API support come to Azure Functions?
The answer is yes. While it’s very much in preview, the team’s been talking about releasing Open API bindings for Functions. This idea isn’t anything new, but the bindings look promising.
With bindings, you’ll be able to decorate your functions with bindings like:
[OpenApiOperation("addStuff", "stuff")]
[OpenApiRequestBody("application/json", typeof(MyRequestModel))]
[OpenApiResponseBody(HttpStatusCode.OK, "application/json", typeof(MyResponseModel))]
I’m seeing JSON.NET decorators (hat tip to the team for not pushing System.Text.Json
on us), optional metadata configuration, and security and authentication support. It’s early, so if you do try it out be patient and report issues as you come across them.
Achieving inheritance with Blazor CSS isolation
After writing about Blazor CSS isolation over the last few months I’ve received a common question: how do I achieve inheritance with CSS isolation? I wrote about it this week.
The concept is a little weird—isolation scopes CSS to your components, and “inheriting” or sharing styles across components seems to go against a lot of those advantages. Even so, in some limited scenarios, it can help maintenance when dealing with similarly grouped components.
From the post (quoting myself in my newsletter deserves a trip to the therapist, I must admit):
If we’re honest, with Blazor CSS isolation, the “C” (cascading) is non-existent. There’s no cascading going on here—isolating your styles is the opposite of cascading. With Blazor CSS isolation, you scope your CSS component styles. Then, at build time, Blazor takes care of the cascading for you. When you wish to inherit styles and share them between components, you’re losing many of the advantages of using scoped CSS.
In my opinion, using inheritance with CSS isolation works best when you want to share styles across a small group of similar components. If you have 500 components in your solution and you want to have base styles across them all, you may be creating more problems for yourself. In those cases, you should stick with your existing tools.
With those caveats aside, how do you do it? The key here is that Blazor CSS isolation is file-based, not class-based, so it doesn’t know about your object graph. This is done with grouping custom scope identifiers, which you can add to your project file. I’ve included these updates in this week’s blog post and in the official Microsoft ASP.NET Core doc.
Ignoring calls from Bill Gates
I’ve really been enjoying reading Steven Sinofsky. A former Microsoft veteran—with stories to share from building out Windows in the antitrust years—he’s writing a serialized book on Substack, Hardcore Software. It’ll be split into 15 chapters and an epilogue. In his first chapter he writes about joining Microsoft. He never returned calls from Bill Gates because he thought his friends were pranking him. When he finally did, he was met with some hilarious frankness:
“Hi, Steve, this is Bill Gates.” … “Hello. Thank you for calling, and so sorry for the confusion. I thought a friend of mine…”
“So, David gave me this list of like ten people and I’m supposed to call all of them and convince them to work at Microsoft. You should come work at Microsoft. Do you have any questions?”
“Well, why haven’t you accepted yet? You have a good offer.”
“I’m considering other things. I have been really interested in government service.”
“Government? That’s for when you’re old and stupid.”
This is a fun history lesson and I’m looking forward to reading it all.
🌎 Last week in the .NET world
🔥 The Top 4
- Andrew Lock finds all routable components in a Blazor app.
- Oren Eini continues writing a social media platform as he deals with the past, tags and searches, works with edits and deletions, counts replies and likes, and handles the timeline.
- Damien Bowden implements app role authorization with Azure AD and ASP.NET Core.
- Stephen Cleary continues writing about asynchronous messaging.
📢 Announcements
- David Ortinau provides a MAUI update.
- Scott Addie provides a rundown of what’s new in the ASP.NET Core docs.
- Azure Event Grid is now in public preview for Azure Cache for Redis.
- Dapr v1.0.0-rc.3 is now available.
- The January 2021 release of VS Code is out.
- Redgate announces they are committing to the future of PASS.
- Microsoft released PowerToys 0.31.1, with a better FancyZone editor.
📅 Community and events
- If you didn’t know, GitHub discussions area thing. Now that you know they are a thing, the ASP.NET Core team has stopped using them.
- Microsoft Ignite registration is open.
- JetBrains released 2020.1 EAP for Rider and also 2020.1 EAP for ReSharper.
- For community standups, we’ve got Xamarin talking about Community Toolkit updates, Machine Learning talking about Jupyter and .NET Interactive, and ASP.NET talks about Dapr.
- The .NET Docs Show automates kombucha availability with .NET.
🌎 Web development
- Dave Brock writes about how to achieve style inheritance with Blazor CSS isolation.
- Niels Swimberghe deploys Blazor WASM apps to Netlify.
- Imar Spaanjars builds and auto-deploys an ASP.NET Core app.
- David Grace starts writing about Blash, a Twitter dashboard.
- Brady Gaster creates discoverable APIs with ASP.NET Core 5 Web API.
- Marinko Spasojevic works on Facebook auth in Blazor WebAssembly hosted applications, and also works with Google auth as well.
- Daniel Jimenez Garcia writes about Kubernetes for ASP.NET Core developers.
- Eve Turzillo writes about strategies for debugging common website issues.
- Khalid Abuhakmeh works with IOptions in ASP.NET Core.
- Tobias Ahlin continues writing about GitHub’s new homepage.
🥅 The .NET platform
- Alexandre Zollinger Chohfi writes about command line parsing in .NET 5.
- David Ramel writes about .NET 6 desktop dev options.
- Peter Mbanugo introduces gRPC in .NET Core and .NET 5.
- Konrad Kokosa continues his series on .NET GC internals.
- Khalid Abuhakmeh writes about common files in a .NET solution.
- Nick Randolph writes about WinUI 3.0 misconceptions.
⛅ The cloud
- Richard Seroter compares cloud shells across the various cloud providers.
- The Azure SDK folks write about the state of the SDK.
- ErikEJ finishes his series on advanced automated deployments of Azure SQL with Azure DevOps.
- Jonathan George writes about configuration in Azure Functions.
- Leonard Lobel works with transactions in Azure Cosmos DB with the .NET SDK.
📔 Languages
- Michael Shpilt writes about what he learned about C# from job interviews.
- Szymon Kulec writes about his mental model of Span, Memory, and ReadOnlySequence in .NET.
- Patrick Smacchia includes IL offsets into production exception stack traces.
- Jason Roberts writes about using declarations in C# 8.
🔧 Tools
- Paul Vick writes about recent Visual Studio improvements that help with working with large .NET 5 solutions.
- Huang Qiangxiong analyzes gRPC messages with Wireshark.
- Matthew MacDonald writes about the new Windows Terminal.
- Rick Strahl opens an admin Windows Terminal from Visual Studio.
- Lee Richardson looks back on lessons learned when using Cake.
- Matt Lacey updates his VS extension to search Stack Overflow.
- David Ramel writes about tips for working with VS Code.
- Johnny Reilly works with ASP.NET, Serilog, and Application Insights.
📱 Xamarin
- Steven Thewissen handles the new UIDatePicker.
- James Montemagno creates a RadioButton control.
🎤 Podcasts
- The .NET Rocks show talks to Jeff Fritz about Blazor Static Web App.
- The 6-Figure Developer podcast talks to Jeremy D. Miller about Marten DB.
- The Adventures in .NET podcast talks to Maarten Balliauw about developing an IDE.
- The Merge Conflict podcast talks about planning an app release.
🎥 Videos
- The ON.NET Show talks with Reuben Bond about Orleans, deploys Orleans apps to Kubernetes, and runs PHP and WordPress sites on .NET with PeachPie.
- The Xamarin Show walks through the Xamarin Community Toolkit.