DO Parse That Xml

by Mikael Henriksson 8. August 2010 21:53
This is a response to John Sonmez post “Don’t Parse That Xml”. I am not going to say that John is wrong on the generation part, it’s a good tip but he seems to totally have forgotten about LINQ to XML. I have had to work with some API’s that don’t benefit from that type of  generated schema a... [More]

Tags: ,

C# | Xml

Inflector – renaming utilities

by Mikael Henriksson 3. July 2010 11:04
One of my favorite utilities when working with 1. C#, 2. ORM, 3. DBA has been and will always be Inflector.  It takes any string input and changes ist’s form. For instance it can make your "some_table" in the database become "SomeTable" in C# by calling the right method. T... [More]

Tags:

C# | Tools

Moving from NUnit tests to MSpec

by Mikael Henriksson 5. June 2010 23:26
Today I did something brain numbing moving away from NUnit to Machine Specifications. The reason being, it’s a lot nicer from a business perspective. In this case the business is open source and free of charge but it makes more sense. The way mspec forces me to think about the test context and the... [More]

Tags: , ,

C# | Testing | MSpec

How I remove duplicates from something that implements IEnumerable<T>

by Mikael Henriksson 5. June 2010 18:32
I admit it does not work for everything and only in C# 4 but it’s a useful extension none the less. public static IEnumerable<T> RemoveDuplicates<T>(this IEnumerable<T> items) { return new HashSet<T>(items); } The hash set does not allow duplicates!

Tags: ,

LINQ | C#

Supporting multiple databases with NHibernate - take 1

by Mikael Henriksson 18. March 2010 04:27
This is a very naive and silly attempt but it’s working. I suppose under high work load and supporting many databases I guess you need to shield the web servers from having to host too many SessionFactories. This was the simplest way I could think of. I am actually getting the connection string as ... [More]

Tags: ,

NHibernate | C#

Using extension methods to handle Xml

by Mikael Henriksson 16. February 2010 08:42
I have created a few very useful extension methods for handling the System.Xml.Linq namespace that I use all the time. I’ve had positive feedback on this before (and it showed up in this post) and now I had to create a couple of extra extensions just to make my life even easier. The way I work... [More]

Tags: , ,

C# | LINQ | Xml

Copying a specific subfolder of a parent folder

by Mikael Henriksson 14. February 2010 01:23
I have a service that sends our application to customers based on various criteria's. I want to verify the most important parameters and to do that I of course need to copy the whole darn folder structure to the directory the tests are run from to simulate the web client. To please both Team City a... [More]

Tags:

C#

How should I use AutoMapper?

by Mikael Henriksson 13. February 2010 16:12
It is actually really simple and I have to thank my boss, DBA and friend Fridthjof for that. If you ever thought it is difficult to work with a DBA then imagine having one as your boss! *joke*   He’s a great guy and as a DBA he is actually very understanding and I have been able to ... [More]

Tags: , ,

C# | Testing | AutoMapper

Collecting all constant values of a class using reflection

by Mikael Henriksson 6. February 2010 16:43
I sometimes have to test outgoing messages before we send them out. Since we work in the mobile industry we need to communicate with mobile phones and alas most countries have legal requirements that we much abide to. Because of some Swedish and Norwegian characters like “åäö&r... [More]

Tags: ,

C# | Reflection

NHibernate – A waste of precious time!!

by Mikael Henriksson 8. May 2009 00:13
By coincidence I found something called Fluent NHibernatewow automatic mappings etc. After having a read up on NHibernateI also found something called NHibernate Validationthat seemed to serve my purposes well. The only reason for having a look around was to easily add validation to my classes. I fo... [More]

Tags: ,

C# | NHibernate

About the author

Life architect specialized in programming