Category «Reflection»

Articles relating to reflection.

Simulating SQL Server (Part 3)

If you haven’t done so so already, start with – Simulating SQL Server (Part 1) Simulating SQL Server (Part 2) In the first two posts, I introduced the SqlTester library, which can be downloaded at the bottom of this post.  I also showed a series of classes that implemented IDataRecord and IDataReade to allow the creation …

Simulating SQL Server (Part 2)

If you haven’t read it already, why not start with Simulating SQL Server (Part 1)? Last time we looked at creating a RecordSetDefinition  as a collection of ColumnDefinition s.  Once we had a way of defining what a recordset looks like, we then were able to create an ObjectRecord . The next step is to collect those …

Simulating SQL Server (Part 1)

In my last post, I talked about creating random values for all kinds of interesting types.  One of the biggest complaints I get when encouraging developers to implement unit tests (or dare I say even start thinking about TDD as a development methodology) is that testing code that accesses databases is a huge pain.  For …

The problem with null checking

The .NET framework is littered with the following code (e.g. from the System.Guid class):

A common scenario when creating a publicly accessible method is to validate the parameters being passed into the method and throw an exception when something is amiss.  I used this example as Guid.ParseExact was only added in .NET 4, showing …