Archives
-
New Blog
As some of you may have noticed, I've been having several issues with the weblogs.asp.net hosting platform. I've been using it since 2009, but, in the last months, it has become increasingly unstable. This is to say that I've picked a new blogging platform, and it's Blogger.
-
Service Discovery in .NET
Service Discovery is a common pattern in distributed systems, like microservices, where one does not need to know the exact address of a resource, instead we ask some kind of database-backed service to get it for us. This is very useful to prevent hardcoding such addresses, instead they are discovered dynamically at runtime. There may be other functionality, but it may also include checking the health of a service first, or rotating the exact address to return, when there are many possibilities.
-
ASP.NET Core Features
Request Features, or feature interfaces, offer a centralised way to access functionality that is commonly added by middleware in the pipeline. Features allow us to access information, or, in some case, control the behaviour of the middleware they belong to.
-
Rate Limiting in ASP.NET Core
Rate limiting is sometimes known as throttling, even though they're not quite the same - rate limiting is more about fairness, making sure everyone gets a fair share (number of requests), whereas throttling is about limiting, or cutting down, the number of requests. The two are commonly used interchangeably.
-
Using MongoDB with Entity Framework Core Session
Yesterday I did a talk on a joint Porto.DATA and Azure & AI User Group Portugal event (thanks, Ivan Campos and Pedro Sousa, for inviting me!) on using MongoDB with EF Core. The slides are here (Portuguese only, sorry!).
-
Blog Maintenance
I updated some of the links in my blog, removed outdated/broken links, added a few others (friends, links collections). This will be the last thing I'll do before going on annual leave, be back by the end of August! Enjoy your vacations!
-
Checking the Health of an ASP.NET Core Application
Having a way to evaluate the health status of our system has been around since ASP.NET Core 2.2. In a nutshell, the idea is, you register a number of health checks, and you run them all at some time to assess their state, if any of them returned anything other than healthy, then the system is considered to be either unhealthy or degraded.
-
Getting Location and Weather from an IP Address
The concept of getting the location for a given IP address is not exactly new, and some posts have been written about it already. Still, I wanted to write about it because I will need it for a later article, and, to add something, also explain how to get the weather forecast for the given location.
-
Caching HttpClient Requests
The HttpClient class is Microsoft’s recommended approach for making raw HTTP calls in .NET. It allows you to send arbitrary HTTP requests (including headers) through a request/response pipeline of message handlers. These handlers can be used to augment the request and response messages and add additional policies, such as retrying operations, handling errors, and so on. One thing that is missing from the out-of-the box behaviours is caching of GET requests (only ones that can be cached!), and that’s what I’ll be talking about here. The concepts introduced in this post will be used in a few days in another one, so please keep an open eye!
-
.NET 8 Data Annotations Validation
I wrote about entity validation in the past, the reason I'm coming back to it is that there are some changes in .NET 8, that I haven't revisited. Time for a refresher!
-
EF Core Entity Validation
Note: I wrote a post about Data Annotations validation here.
-
Soft Deletes with Entity Framework Core ā Wrap Up
Those that follow this blog probably know about my series of posts on soft-deletes with EF Core, which you can find here:
-
Soft Deletes with Entity Framework Core ā Bulk Deletes
This is post 4 on a series of posts on soft deletes with EF Core. On none of my posts on this series did I mention that these solutions do not work with bulk deletes, introduced in EF Core 7, but they really don't. That is because they rely on the change tracking mechanism and the bulk delete and bulk update functionality does not use it. But as with most of EF Core, there is certainly a way around it, and in this post I will present one, using IQueryExpressionInterceptor, one of the new interceptors introduced in EF Core 7. There is also an open ticket for adding an interceptor mechanism for bulk updates, which will probably also include bulk deletes.
-
Read-Only Entities in EF Core
One feature that has been conspicuously missing from EF Core is read-only entities, meaning, the possibility to mark an entity type as read-only, in which case, no changes to its instances (inserts, updates, deletes) will be allowed; data needs to be added to the database by other means. There is currently an open ticket to track this functionality, which has been open for quite some time. While it is currently not possible to achieve exactly this functionality, there are some possible workarounds that require very little coding.
-
Soft Deletes with Entity Framework Core - Part 3
Update: SoftDeleteConvention is now generic.
-
On Architecture ā Part 2: Data Storage and Access
Second post on a new series on software architecture. First one here, on high-level system communication. This time Iām going to talk a bit about data storage and how to access the data.
-
EF Core Performance Optimisations
We all know O/RMs aren't the fastest tools when it comes to loading data, and Entity Framework Core is surely no exception. After all, they need to do a lot of operations, such as translating LINQ queries to SQL, instantiating the right entities, hydrating them (setting their properties from the database-retrieved values), taking a snapshot for the change-tracking functionality, etc, etc. But there, however, are a few things that we can do to help speed things a bit! Here are a few tips for you to make the best usage of Entity Framework Core.
-
ASP.NET Core API Versioning
When you have an existing deployed REST API that you want to change, you generally need to be very careful. Why would you want to change it? There can be a number of reasons: