NOTE: This is the web version of my weekly newsletter, released on June 14, 2021. To get the issues right away, subscribe at dotnetstacks.com or the bottom of this post.
Happy Monday! Here's what's going on this week:
- The big thing: Putting a bow on .NET 6 date and time updates
- The little things: Have I Been Pwned project updates, VS Code remote repositories extension, App Service support on .NET 6, Azure Functions updates
- Last week in the .NET world
The big thing: Putting a bow on .NET 6 date and time updates
In a previous issue, we briefly spent some time exploring the new date and time APIs in .NET 6. (Despite feedback of the cringy title, I stand behind DateTime might be seeing other people.) In these posts, I passed along the information from various GitHub issues. This week, it was nice to see Matt Johnson-Pint officially write about it in detail on the .NET Blog.
Here's the gist: the .NET team is rolling out new DateOnly
and TimeOnly
types for .NET 6.
The DateOnly
type, if you can believe it, only supports a date—like a year or a month. You might want to use this when you don't need an associated time, like birthdays and anniversaries. With DateOnly
Microsoft promises better type safety when you only want dates, serialization improvements, and simplicity when interacting with databases. DateOnly
ships with a robust constructor but no deconstructor.
As for TimeOnly
, you'd use it only to represent a time of day. Potential use cases are alarm clock times, when a business is open, or recurring appointment times. Why not TimeSpan
? Here, TimeOnly
is intended for a time of day and not elapsed time. Again, you'll gain type safety and more accuracy when calculating ranges.
There's a lot of chatter in the community asking: why not use Noda Time instead? From the post:
Noda Time is a great example of a high-quality, community developed .NET open source library ... However, we didn’t feel that implementing a Noda-like API in .NET itself was warranted. After careful evaluation, it was decided that it would be better to augment the existing types to fill in the gaps rather than to overhaul and replace them. After all, there are many .NET applications built using the existing
DateTime
,DateTimeOffset
,TimeSpan
, andTimeZoneInfo
types. TheDateOnly
andTimeOnly
types should feel natural to use along side them.
As an FYI, the new structs aren't supported in Entity Framework Core 6 yet, but you can check out this comment to find a relevant tracking issue. You'll want to check out the post—in addition to the new DateOnly
and TimeOnly
structs, the .NET team is rolling out time zone enhancements as well.
These changes aren't replacing any DateTime
APIs, just augmenting them. So when it comes time for you to switch to .NET 6, do what works for you.
The little things: Have I Been Pwned project updates, VS Code remote repositories extension, Azure Functions updates, App Service support on .NET 6
This week, we'll talk about Have I Been Pwned, a new Visual Studio Code extension, and updates on running Azure Functions and Azure App Service updates on .NET 6.
Have I Been Pwned project updates
You've likely heard of Troy Hunt's Have I Been Pwned project. At the risk of oversimplifying all that Troy does, you can use it to check if your personal data has been compromised by data breaches. With the help of Cloudflare and Azure Functions, he's been able to operate at a tremendous scale with minimum cost. That site is now getting around 1 billion requests a month.
Last August, Troy announced his plans to take HIBP to open source. Recently, Troy wrote that the Pwned Passwords component is now a .NET Foundation project. You can check out the code at the HaveIBeenPwned organization on GitHub. As a .NET developer, it's a nice way to look at the code and how it all works, especially when it comes to getting hashes and anonymizing requests.
VS Code remote repositories extension
In this space last week, we mentioned a new VS Code extension for Project Tye. Visual Studio Code is at it again with a new Remote Repositories extension. With this extension, you can browse, search, edit, and commit to any remote GitHub repository without a clone. This extension will support Azure DevOps soon as well. (GitHub is the long-term vision, yet Microsoft is consistently releasing these new capabilities to Azure DevOps. For this and other reasons, I'm pretty sure Azure DevOps will outlive me.)
Personally, looking at GitHub repos is good for my learning—both for what to do and what not to do—and there should be a middle ground between browsing g_ithub.com_ and cloning a big repository to my machine. This should help.
Azure Functions updates
Last week, Azure Functions PM Anthony Chu wrote about recent Azure Functions updates. (I'll be interviewing him soon here, so hit me up if you have any other questions.) We've written about some of what he mentioned, but not everything—here's the latest.
- Visual Studio support for .NET 5.0 isolated function apps : Released in May, Visual Studio 2019 16.10 includes full support for .NET 5.0 isolated process Azure Functions apps. You can check out the tutorial.
- You can run .NET 6 on Azure Functions : To do this, you'll need Azure Functions V4—right now, it's limited to a preview release of Azure Functions Core Tools V4. Check out the post, as there are a few caveats to keep in mind. It's early, and there's no official support yet. Microsoft has published a tutorial on writing .NET 6 apps on Azure Functions.
Azure App Service support on .NET 6
In somewhat related Azure development news, you can use .NET 6 Preview bits on Azure App Service—in either Windows or Linux workloads. You can do this through the Azure App Service Early Access Runtime feature. This feature allows you to get the latest version of SDKs for various languages. With Early Access Runtime, you can get access without waiting for a release cycle.
Microsoft is boasting that it's the first time a pre-release stack is publicly available on App Service before the GA release.
🌎 Last week in the .NET world
We've got another busy week with some great content from the developer community.
🔥 The Top 5
- Matt Johnson-Pint writes about Date, Time, and Time Zone Enhancements in .NET 6.
- Claudio Bernasconi works on Blazor component communication and state handling.
- Leomaris Reyes uses Maps with Xamarin Essentials.
- Microsoft announces the new Remote Repositories extension for Visual Studio Code.
- Joseph Guadagno migrates to ASP.NET Core MVC from ASP.NET Framework MVC.
đź“… Community and events
- For community standups: ASP.NET talks about Blazor updates, and Machine Learning holds office hours.
- The .NET Docs Show talks to Niels Swimberghe about making calls with Twilio and Blazor WebAssembly.
- Troy Hunt expands the Have I Been Pwned volunteer community.
🌎 Web development
- The Code Maze blog uses Hangfire with ASP.NET Core.
- Matthew Jones starts developing a solitaire game in Blazor.
- Adam Storr extends HttpClient testing with templating.
- Bruno Sonnino explores Minimal APIs in ASP.NET Core.
- Andrea Chiarelli builds ASP.NET CRUD Web APIs.
- Damien Bowden explores integration testing for ASP.NET Core using EF Core Cosmos with XUnit and Azure DevOps.
- Dave Brock writes about minimal APIs in .NET 6.
🥅 The .NET platform
- Jonathan Allen writes about .NET 6 collections improvements.
- Richard Lander hosts a conversation about containers.
- Andrew Lock explores .NET interactive notebooks with VS Code.
- Patrick Smacchia recaps .NET obfuscator tools.
- John Miller develops apps for Microsoft Teams with .NET.
- Abhijit Jana works with command-line arguments and C# 9.0 top-level statements with Visual Studio.
â›… The cloud
- Anthony Chu writes about what's new with .NET on Azure Functions.
- Chris Noring builds apps locally with the Azure Static Web Apps CLI.
- Dominique St-Amand works on a CosmosDB Linux container for your CI builds.
- Shelton Graves continues his series on working with events in Azure.
đź“” Languages
- Matthew MacDonald previews 5 new features in C# 10.
- Davide Bellone writes about how to get the index of an item in a foreach loop.
- Ken Bonny rediscovers implicit casting.
🔧 Tools
- Anant Vernekar integrates Swagger With ASP.NET Core Using Entity Framework.
- Khalid Abuhakmeh writes about JetBrains Rider plugins for ASP.NET Core developers and how to import settings from Visual Studio and VS Code to Rider.
- Wael Kdouh automates deployments of Azure Logic App Using Azure DevOps.
- Jon Gallant uses the GitHub CLI and Git with GitHub Codespaces.
- David Ramel writes about Rider's improvements with Blazor WebAssembly debugging.
- Lauren Del Signore writes about useful Visual Studio extensions for working with Blazor.
🏗 Design, testing, and best practices
- Al Tenhundfeld asks: what makes a good Git commit?
- Mark Hinkle asks: has serverless jumped the shark?
- Steve Smith writes about C# generics best practices.
- Joydip Kanjilal writes about best practices for designing RESTful APIs.
🎤 Podcasts
- The 6-Figure Developer Podcast talks to Guy Royse about Redis.
- The Adventures in .NET Podcast talks about Uno Platform.
- The Xamarin Podcast talks about .NET MAUI.
- Jesse Liberty talks to Jeff Fritz about Blazor and Azure.
- .NET Rocks talks to Jeremy Miller about event sourcing.
- The Coding Blocks Podcast continues talking about the DDIA book.
Top comments (0)