Khalid Abuhakmeh

Software Developer and All Around Nice Guy @AquaBirdConsult

Registering ASP.NET MVC Route Constraints for Attribute Routing

Route constraints are a powerful tool when building ASP.NET MVC applications. While I rarely use route constraints, there are opportunities to use them that make perfect sense. I normally use route constraints when building simple content management systems (CMS). Let's take a look at what our routes may look like.

/{*page}/contact/about/ . . .

Read More

June 28, 2015

A Bug with ASP.NET MVC ValueProviders and Formatting

Magic turns to Voodoo

I was working with Chad, a colleague of mine, on a simple ASP.NET MVC application, the typical CRUD kind. We were attempting to use an editor template in our project to display a DateTimeOffset object as a short date string. Every time we would submit our form, the date would go from a short string format to the full format. What the heck was . . .

Read More

June 23, 2015

Capturing ASP.NET Application Startup Exceptions

It has become common practice to perform tasks during an ASP.NET applications start up process. These tasks may include registering routes, configuring filters, wiring up third party dependencies, and so much more. Here is the default ASP.NET MVC application startup code pulled from the sample.

protected void Application_Start(){  . . .

Read More

June 21, 2015

Handling Exceptions In C# Console Applications

Console applications still have a very valuable place in the life of most .NET developers. I also believe that we are about to see a console application renaissance with the recent introduction of Azure WebJobs and the excitement around Microservices. When writing any application it is important to handle exceptions, or at the very least log . . .

Read More

June 18, 2015

Charming Your Entity Framework Use

Making Sure You Don't Get Bitten

As a user, If I've learned anything about Entity Framework (EF), is that this venom spitting BEAST that needs to be respected. Utilizing it incorrectly can lead to a gaggle of wrong results, expensive executions, and crashes. On the other hand, utilizing EF correctly can yield wonderful results. This post will show the "best" . . .

Read More

June 17, 2015

What's The Deal With Nullables and Lambdas?

Fixing a bug within RimDev.Filter

At Ritter Insurance Marketing, we developed a nice simple library around filtering enumerables called RimDev.Filter. It works great for our APIs.

On Friday, we ran into an interesting case with nullables. The following code would throw an exception.

private class Person{ public decimal? Rating { get; set; }}var @return = people.Filter(new{  . . .

Read More

June 14, 2015

ASP.NET Web API Easier ModelBinder Registration

In our current API work, we use a few custom types. We also let our clients send in comma delimited arrays of primitive types. To support our choices, we need to utilize WebAPI's IModelBinder interface. Our previous registration code looked like this.

var provider = new SimpleModelBinderProvider(typeof(string[]), new  . . .

Read More

June 10, 2015


All Categories: c#(1) home