X

Optimize database traffic with future results in NHibernate

One nice feature that NHibernate has is future results. It is technically a capability to put queries on hold until data is actually asked. When data is asked then all queries are sent to server as one batch. This blog post shows how to use future results with NHibernate.

Displaying enum as select list in ASP.NET Core

Some properties of model classes come as enums and we want to show enum values in select list when edit form is opened. Sometimes we want enum element names but sometimes we want to use custom names or even translations. his blog post demonstrates how to get enum element names to select list on ASP.NET Core.

EF Core 5.0: Using ToQueryString() method to translate LINQ query to SQL

Entity Framework Core 5.0 comes with SQL-based brother to ToString() method for LINQ-queries. This method is called ToQueryString() and it returns provider-specific SQL without connecting to database server. This blog post shows how ToQueryString() method works.

Using query strings in ASP.NET Core unit tests

Using query string in controller unit tests is actually easy until we don’t need anything more advanced. We can buld up a string with query parameters and go with it. But what if things get more complex and we need encoding or multiple values? Here’s how to build safe query string for ASP.NET COre controller unit tests.

Updating SQL Azure database using Visual Studio database project and Azure DevOps

Visual Studio database projects have been one of my important tools since Visual Studio 2010. Database projects were not easy to use with build servers ten years ago. Today things are different. It’s super easy to use database projects to update staging and live databases from Azure build and release pipelines. This blog post shows how to do it.

Creating storage accounts and blob containers using Azure fluent API-s

Using Azure fluent API-s it is easy to create storage accounts and blob containers. After experimenting with fluent API of Azure storage I found it to be good match for multitenant web applications where tenant files are held on Azure blob storage. I was surprised how clean and short code I got using fluent API. Here’s my overview of fluent API for Azure storage with some code samples I wrote.

MSSQL data and log files on Azure blob storage

I discovered lately one killer feature of SQL Server – keeping data and log files on Azure blob storage. There are scenarios where we may want to go with blob storage instead of buying and building up our own stable and reliable storage. This blog post introduces how MSSQL data and log files work on Azure blob storage.

Using data from MSSQL linked server with EF Core

My previous blog post Querying MySQL from SQL Server using linked server introduced how to link MySQL database to MSSQL and how to write queries that gather data from local and linked server. This blog post demonstrates how to get data mixed from those sources to Entity Framework Core.

Querying MySQL from SQL Server using linked server

SQL Server has interesting feature calles Linked Servers. It’s about linking other databases to SQL Server and using their data like it’s local. There are many powerful open-source systems written on PHP and they are mostly using MySQL as database. This blog post shows how to link MySQL database to SQL Server and how to use linked server in SQL queries.

Implementing repository querying interface in EF Core DbContext

My last bold statement was that we don’t need custom unit of work and repository classes with Entity Framework Core. One issue remained unsolved and it was querying part of repositories (yeah, those custom querying methods). After some experiments to get querying interface of repositories to DbContext I worked out something that I kind of like. I managed to make DbContext to work like classic unit of work that hosts repository instances. Here’s my experiment and the solution I worked out.