An elegant way to write XML with Linq

While writing out some XML to a file I found a lot nicer way to write out XML while using Linq and the XStreamingElement. The key is to use the XStreamingElement with data from a Linq datasource like so :

The above code will create the xml below (if the data is formatted correctly).:

As an added bonus … Read More

Mike GriffithAn elegant way to write XML with Linq

The type initializer for ‘AutoMapper.TypeMapFactory’ threw an exception. Error with Automapper.

Recently while doing some conversions with Automapper I ran into an error while running it. I was getting the “The type initializer for ‘AutoMapper.TypeMapFactory’ threw an exception.” with an inner exception of “This type is not supported on this platform IDictionaryFactory”. After doing some debugging I finally figured out that it was due to the Automapper dll itself not being … Read More

Mike GriffithThe type initializer for ‘AutoMapper.TypeMapFactory’ threw an exception. Error with Automapper.

Replacing strings with the Filehelpers library.

While working at my current job I’ve been doing a lot of file imports and conversions, so to figure out a more efficient way to do the conversions I did some research and found the FileHelpers library. Now the FileHelpers library makes things very easy to do field conversions by creating attributes that you can connect to each record field … Read More

Mike GriffithReplacing strings with the Filehelpers library.

Building a Windows Service that periodically runs.

Here is some code I threw together to create a windows service that gets called periodically. To use it you’ll have to add this code into the Service class and create an application setting called PollingTime to contain the amount of time between calls of the process. Also note that if the process is still executing then it will block … Read More

Mike GriffithBuilding a Windows Service that periodically runs.

App.config transforms with Slow Cheetah

Recently while working on a console app that I was building for work I found myself missing the web.config transforms that are used in web projects. For those who don’t know you can build transform file that will change your web.config files depending on what build type you are running at the time. This comes in extremely useful when you … Read More

Mike GriffithApp.config transforms with Slow Cheetah

Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.

When running your application on another machine are you getting the following error ‘Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.’? Most of the time this is due to a dll or other piece of code not being included in the build file and it doesn’t exist on the new machine. … Read More

Mike GriffithUnable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.

Using table valued parameters to efficiently pass lists into SQL Server stored procedures

While optimizing some code, I came across this very comprehensive article on the most efficient way to pass a list of items into a SQL Server stored procedure. To summarize the article the fastest way to pass in a list is to use table valued parameters, but the ORM tool that we are currently using Mindscape Lightspeed has no support … Read More

Mike GriffithUsing table valued parameters to efficiently pass lists into SQL Server stored procedures

Review of The Art of Unit Testing with Examples in .NET

While working on some unit tests at one of my former employers, I reached a point where it became obvious that I’d hit a wall and I didn’t know of a good way to structure and build the tests that I was working on. What I didn’t know at the time was that I was wasting a lot of time … Read More

Mike GriffithReview of The Art of Unit Testing with Examples in .NET

Saving xml from web service calls in .net.

While working on some some web service calls at work I ran into a situation where I needed to record the XML that was being passed from both sides. After doing some Google searching I came across the following code on Microsoft’s site.

Essentially this code hooks into the base web service code and saves the XML that flows … Read More

Mike GriffithSaving xml from web service calls in .net.

How NOT to teach a computer language

For the past year or so my wife has been taking online classes to get a computer science degree. For most of her classes she’s done great, she’s been flying through HTML and SQL, even up to the point where she can handle multilevel joins and optimizing through indexes. That was until she hit her vb.net class. I had no idea why she was having problems with a language has easy as vb.net so I started helping her out and find out why she was having so many problems.

Mike GriffithHow NOT to teach a computer language