Open XML – OLE Automation Date Issues
If you are exporting a date from C# to Excel using 2007, you probably will use the following: Math.Round(DateTime.Now.ToOADate(), 12).ToString() This exports the date as a OLE Automation date recognized by Excel 2007. How ever, in Excel 2010 this was causing issues, every time I exported to Excel 2010, it said that it has to [...]
EF Strongly Typed ObjectQuery.Include
The problem that I faced was having to put up with “hard coded” strings in the ObjectQuery.Include function to load related objects through POCO objects in the Entity Framework. This faced challenges when I renamed columns in the Model which caused a run-time error when recompiling and re-starting the application. Thanks to David Kiff, we [...]
Fixing the EF Tracing and Caching Provider Wrapper Issue
If you have been using the Tracing and Caching Provider Wrappers for the ADO.NET Entity Framework 4.0, you might of come across this error message when creating POCO objects, adding them to a Data Context and commiting them to the database using the Caching Wrapper: [NotImplementedException: The method or operation is not implemented.] EFCachingProvider.EFCachingDataReaderCacheWriter.GetName(Int32 ordinal) [...]
Random number of items from a Generic List extension method
Here is a code snippet for returning N number of items from a generic list using a extension method. This requires .NET 3.5. public static class Extensions { /// <summary> /// method for returning N number of random items from a generic list [...]
The custom tool ‘MSLinqToSQLGenerator’ failed. Unspecified error
I kept getting this error “The custom tool ‘MSLinqToSQLGenerator’ failed. Unspecified error. For me, this was caused when I was using partial classes and had several using statements at the top of the file: using System.Data.Linq; using System.Data.Linq.Mapping; using System.Data; using System.Collections.Generic; using System.Reflection; using System.Linq; using System.Linq.Expressions; using System.ComponentModel; using System; {namespace} {code} To [...]
Interview Questions Part 1
Over the past month, I have been interviewed by several companies and I thought I would share some of my experiences. Here are some of the questions I was asked (Technical): What is the difference between a reference type and a value type? What is the difference between a stack and a heap? What is [...]
Modify a Word 2007 Open XML document via C#
Interesting problem that I came across here…A client requested that their system was to have the ability to load in a Word 2007 Document, perform some text manipulation routines and save the document back to the server. Firstly, you can rename a docx document to docx.zip and you can extract all of the files in [...]
A CMS that integrates into ASP.NET MVC
Here is a open source CMS called N2 that provides a CMS framework to build web applications on using the ASP.NET MVC Model. Its a very basic CMS, but it provides all the core functionality including Pages, Articles and a .NET Permissions Model (it also has some add ons and allows developers to contribute their [...]
Decoupled Code using SubSonic
Subsonic is fantastic when generating a bunch of classes directly from the database structure…but the issue comes when OO/Application Objects clash with relational database structures. An idea is to use Subsonic to query the data from the database and map the data directly to a application/OO object. A really good example following the link below [...]
Best Coding Practices – TIP 3
The use of partial classes can help improve coding for the following reasons: As you can split code into seperate physical files, its easier to seperate UI and Business Logic that may belong in a single class Produces clean and organised code No performance hit… The compiler groups all partial classes into one entity during [...]


