Introducing SharedFlat
IntroductionA multitenant web application is one that responds differently depending on how it is addressed (the tenant). This kind of architecture has become very popular, because a single code base...
View ArticleSharedFlat and Multitenant UI
IntroductionIn my previous post, I introduced SharedFlat, a library for making multitenant ASP.NET Core apps easier to build. This time I’m going to talk about how can we customize the UI per...
View ArticleSharedFlat and Databases
IntroductionThis post is part of a series on SharedFlat. See here the first (introduction) and here the second (UI). This time I will be explaining how SharedFlat handles multitenant databases.There...
View ArticleModern Web Development with ASP.NET Core 3 Discount Code
If you are interested in my book, Modern Web Development with ASP.NET Core 3, from Packt Publishing, you can use this code for a 25% discount: 25MODERNWEB.Get it from Amazon:...
View ArticleASP.NET Core Pitfalls – Areas
There are a few problems with using areas:The _ViewImport.cshtml and _ViewStart.cshtml files are not loaded by views inside an area, which means that, for example tag helpers registrations are lost and...
View ArticleASP.NET Core Pitfalls - Localization with Shared Resources
When localizing a web application using resources, there are two common ways:Using a resource per Razor view or pageUsing shared resources, e.g., not bound to a specific view or pageBy default, ASP.NET...
View ArticleASP.NET Core Pitfalls – Returning a Custom Service Provider from...
In pre-3.1 versions of ASP.NET Core, you could return your own service provider (AutoFac, Ninject, etc) by returning some IServiceProvider-implementing class from the ConfigureServices method. This is...
View ArticleASP.NET Core Pitfalls Index
Here is the list of posts so far on ASP.NET Core Pitfalls:Redirect to Action Keeps Route ParametersSession StorageLocalization with Shared ResourcesAreasReturning a Custom Service Provider from...
View ArticleASP.NET Core Pitfalls – Dependency Injection Lifetime Validation
As you can imagine, it doesn’t make much sense to have a service that is registered as singleton to depend on another service that is registered as scoped, because the singleton instantiation will only...
View ArticleInterfaces and Inversion of Control
The way I see it, there are three reasons for using an Inversion of Control (IoC) / Dependency Injection (DI) container:To decouple the actual implementation from a base class/interface (the contract),...
View ArticleInline Images with ASP.NET Core
The most common way to show an image in an HTML page is to use the <img> tag to load an external resource. Another option is to use a URL that is a Base64 encoded version of the image. There are...
View ArticleASP.NET Core Pitfalls – Async File Uploads
When performing file upload(s) to an asynchronous action, it may happen that the uploaded file(s) may not be accessible, resulting in an ObjectDisposedException. This is because the uploaded files are...
View ArticleASP.NET Core Pitfalls – AJAX Requests and XSRF
When using Anti Cross Site Scripting Forgery (XSRF) protection in your application, which is on by default, you may be surprised when you try to AJAX submit to a controller and you get a HTTP 400 Bad...
View ArticleASP.NET Core Pitfalls – Null Models in Post Requests
Sometimes, when AJAX posting to a controller, you may get a null model. Why?Let’s exclude the obvious – you didn’t send a null payload. The most typical reason is, the serializer could not deserialize...
View ArticlePosting AJAX Requests to ASP.NET Core MVC
IntroductionIn the past, I’ve had trouble doing something that is apparently simple: invoking a simple action method in a controller using AJAX. Although it is indeed simple, when using jQuery, it may...
View ArticleChanging Schema Dynamically in EF Core
Sometimes it may be necessary to change the schema for some entities based upon some criteria. This may be because of multitenancy or because you want to test something and don’t want to pollute the...
View ArticleUsing Generated Methods Instead of Reflection
IntroductionIt is a common thing to say that reflection is slow.You will find tons of posts saying this, and I generally tend to agree to them, although in most cases we generally don’t need to care...
View ArticleCurrent Limitations of Entity Framework Core
IntroductionAlthough EF Core seems to be the most popular ORM in the .NET world in these days – and I for sure won’t contradict it –, there are still some functionality missing, specially if we compare...
View ArticleImplementing React's UseState in C#
It's been a long time since my last post! Well, I'll try to change that. For now, I'll just leave something I was playing with: an implementation in C# of React's UseState function (or hook, in React...
View Article.NET 8 Dependency Injection Changes: Keyed Services
Keyed Services in .NET 8It has been quite some time since my last post on dependency injection (DI). In it I tried to talk a bit about the history of DI (or dependency resolution); now, a change is...
View Article