Stored Procedures Vs. No Stored Procedures

There is this debate raging among developers: “Is it better to use stored procedures or not use stored procedures”.  From first glance, this seems like a simple question, but there are some complicated implications around this question.  Here’s the basic pros and cons of using stored procedures in your system: Pros You can isolate table … Read moreStored Procedures Vs. No Stored Procedures

EF Code-First Stored Procedures With Parameters

Summary In an earlier post I showed how to create a method that can access a stored procedure using Entity Framework Code-First. In this post I’m going to show how to pass parameters and show a few tricks. The Stored Procedure First, you’ll need to create a new stored procedure in your APIUniversity database (see … Read moreEF Code-First Stored Procedures With Parameters

Unit Testing Methods that Call Stored Procedures

Summary One of the biggest problems I used to find in unit testing is that most of the products I work on contain mostly methods that access a database. I found that most objects and methods work with data and it’s very tedious to try and mock or fake the database component. If you’ve followed … Read moreUnit Testing Methods that Call Stored Procedures

How to detect if your code was called from a unit test

I’ve done a few unit test blog posts, but this time I’m going to demonstrate how to detect if a method is running under a unit test. This flag can be used to break dependencies in an object or run a test database instance instead of the production instance. The first article I stumbled across … Read moreHow to detect if your code was called from a unit test

Fluent NHibernate “Not Supported By” Exception

Summary So my company has successfully switched to using Fluent NHibernate for our production systems. So far the results are astounding. One thing our developers have learned is that there is no “perfect” ORM. Not yet anyway. Each seems to have a flaw or two. NHibernate has a couple of issues that can be worked … Read moreFluent NHibernate “Not Supported By” Exception

Fluent NHibernate Using Multiple Database

Summary This time I’m going to show how to use tables from two different databases in one context. It’s difficult to find information on this subject and many links point to an article that uses a dictionary of context’s with all kinds of fancy configuration and code to map things. After an hour of hunting … Read moreFluent NHibernate Using Multiple Database

Fluent NHibernate with MS SQL Server

Summary I’m currently researching all my options regarding ORM’s. In my previous posts I talked about NHibernate and how to setup a simple example. This time I’m going to demonstrate how Fluent NHibernate works and how you can use it to avoid setting up xml documents for mapping your tables. Project Setup Create an empty … Read moreFluent NHibernate with MS SQL Server