Ninject Parameterless Public Constructor Errors

About once a year I have to set up an entire new application from scratch. To help speed this process along, there are many NuGet packages that we typically use. Since we strongly believe in IOC and DI, one of our more important packages is Ninject.

Houston, We Have a Problem

Doing this work so seldom, it is always a bit of a trick to get everything set up properly. Commonly, after installing the Ninject NuGet packages, the first time you try injecting a service into a controller and running a WebAPI method, you will see Continue reading “Ninject Parameterless Public Constructor Errors”

Call stored procedures using DbContext

Staying Warm and Dry

Sometimes I find myself needing to create a complicated bit of logic in the SQL layer (say, for statistical reports.) Later, perhaps someone will ask to see these statistics exposed on a screen through the UI. Suddenly I need this same logic further up the stack. While I’m a fan of using LINQ, too much code duplication of complex logic can result in a maintenance headache. This is even more true when the duplication crosses languages, as when going from SQL to C#. Staying DRY is a good thing.

While I’d prefer to confine most of my coding logic to C# and keep my databases as simple as possible, sometimes this is not practical. In this article I will demonstrate how to call stored procedures using DbContext.

Putting Things In Context

My organization likes to Continue reading “Call stored procedures using DbContext”