George Kosmidis

Microsoft MVP | Speaks of Azure & .NET | Founder of Munich .NET
Building tomorrow @

Parameterized Raw SQL Queries with Entity Framework: How to Unit Test with SQLite

Entity Framework Core allows you to drop down to raw SQL queries when working with a relational database. This can be useful, because raw SQL queries can return entity types or, starting with EF Core 2.1, query types that are part of your model, but it could also be a problem when it comes down to Unit Testing.

Modified 3 years ago

My next events!

Megaron Athens International Conference Centre
Microsoft MVP - George Kosmidis

Thread synchronisation with SemaphoreSlim and async delegate calls

Although running a parallel foreach that makes async calls is a pretty usual task, I found my self in a complicated situation, when async delegate calls got in the way!

Modified 1 year and 3 months ago
Azure Architecture Icons - SVGs, PNGs and libraries

Mocking expected behaviour of SQL functions for Unit Testing with SQLite

While unit testing, I came across a method in an SQL repository class that was using a raw SQL query, and along with that, SQL Server’s newid() function. Since the complicated reason behind this decision was out of scope, I had to find a way to unit test that method…

SQLite was -of course- the first approach, but any attempt to actually test the method would nevertheless fail with the exception Microsoft.Data.Sqlite.SqliteException: 'SQLite Error 1: 'no such function: newid'.'.

Modified 4 years ago

Simple website stress tool with C# and Apache HTTP server benchmarking tool

To be honest, I got bored trying to remember all switches and combinations of Apache’s benchmarking tool! Since I use it sort of rarely, I just wrapped it in a convenient -for me at least- app that I can use without having to remember or read anything!

Modified 1 year and 3 months ago

ASP.NET MVC 5 with Razor Kendo UI: Dynamic Grid Creation – Columns, Ordering, Grouping and Paging

The requirements were simple! A grid that will load a whatever query, grouped by whatever columns, with filters enabled, paging and everything. Easy task with ASP.NET Telerik grids but not easy at all with Kendo UI!

Since we can’t have a ViewModel or Model for the grid (we don’t know what columns a whatever query has!), I came up with a rather different ViewModel that holds descriptions for columns, groups etc…:

Modified 3 years ago

ASP.NET MVC 5: Custom authentication with OnActionExecuting

Although I prefer the AuthorizeAttribute approach, there is another simpler way with a base Controller and OnActionExecuting:

Let’s assume the following Controller:

Modified 4 years ago