Khalid Abuhakmeh

Detailed Sorting Validation Messages for WebAPI Using FluentValidation

On April 29th, I wrote the post "ASP.NET WebAPI and Multi-Column Sorting Queryables". The code in that post allowed any WebAPI user to sort requests based on the representation returned via the response.

Imagine we had the following object:

 name : 'Khalid',
 age : 31

Our sortable fields . . .

Read More

May 07, 2015

Use Stuntman For Development Authentication in OWIN

Anybody can jump a motorcycle. The trouble begins when you try to land it.

Every modern application will have to deal with security. Under .NET, security has been upgraded to use the ClaimsIdentity model and the biggest .NET frameworks have begun utilizing it: ASP.NET MVC, WebForms, and WebAPI. While authentication can be implemented directly in the application, most enterprises are leaning towards using an . . .

Read More

April 30, 2015

Building a Comparison Grid in ASP.NET MVC

The easiest way possible

If you are working in the e-commerce industry, then you are familiar with the comparison grid. Normally a pivot table with the columns representing each option the user has available to them, and each row being the individual features of the option. Take, for example, this comparison grid of subscription options for the Spotify service.

. . .

Read More

April 28, 2015

Introduction to Generics in .NET

Generics are an essential feature of any statically typed language, and C# is no exception. Introduced in .NET 2.0, generics offer a way to strongly type container- like classes at compile time, rather than hoping all goes well at runtime. Previous to the introduction of generics, most developers were forced to cast to the base object class, . . .

Read More

April 26, 2015

Using Lazy For Expensive Data in C#

It's ok to be lazy

I am a big fan of stateful properties on my C# objects, especially when it comes to ViewModels in ASP.NET MVC. Stateful properties describe the current internal state of your object using one or more existing members. Take a look at the following code snippets and consider which one you like better.

var result = !string.IsNullOrWhitespace . . .

Read More

April 25, 2015

Take Your ASP.NET MVC Application Offline via a Global Attribute

Failure is inevitable when building applications. ASP.NET has the ability to take an application offline when things have really gone past the point of recovery. I'll let Scott Guthrie explain how it works.

Basically, if you place a file with this name [app_offline.htm] in the root of a web application directory, ASP.NET 2.0 . . .

Read More

April 22, 2015

ASP.NET WebAPI and Multi-Column Sorting Queryables

Useful for other scenarios as well

Whenever building a querying API, whether web or local,I want to expose some basic features for my consumers: filtering, paging, and sorting. The first two are really easy to implement; well easy in respect to having solved them. Sorting on one field is easy, but becomes increasingly difficult when sorting on multiple fields. In this post, . . .

Read More

April 19, 2015


All Categories: c#(2) elasticsearch(2) oss(1) home