System.BadImageFormatException Could not load file or assembly System.Data.SQLite

I ran into this problem when I tried to re-open a solution I did a while back when labbing with Fluent NHibernate and SQLite.

Behind the cryptic error message lies and easy solution; I was running the 32-bit version of the SQLite-driver and runtime. That’ doesn’t fly on my Windows 7 64-bit machine.

Here is a more through description and here is a link to the latest version of SQLite that will get you all the version (32 and 64 bits) of the SQLite.

Read More

Synchronization for consultants – it works!

I am so proud. My evil scheme to keep my calendar(s) in sync got tested for real today.

Got to new customer. Installed Outlook to Google Calendar. Started Outlook. Viola! All my events from my other calendars in place with the ones from my customer. So now they will not book me on days when I have other assignments etc.

The only thing is that you cannot think to much about it because it will drive you mad. My customer Outlook is synched with Gmail, my Avega outlook is also synched with the same account to Gmail. My phone synchs to Gmail… But it works. ‘Nuff said.

Read More

AutoMapper – get rid of your tedious mapping code

One thing that I really love being on a contract is that you’re almost immediately is forced to find solutions, whereas on a leisure project you rather do something else…

Here is another great tool; AutoMapper. It’s a framework that do all of that tedious mapping code you’re doing in for ViewModels or Messages in services. Boring and tedious to write and test. AutoMapper takes care of that – using a lot of Conventions.

Be sure to see the screencast that introduce a lot of the possibilities.

Read More

SpecFlow BDD .NET-style

In my previous post, I shared my frustrations with TDD and how to effectively start with it. BDD (Behavior Driven Development) seems to be the answer, but the .NET frameworks available for BDD can be quite perplexing. Many either have unconventional syntax or are built on top of other tools that are hard to work with.

SpecFlow appears to be a more approachable solution. It’s designed with inspiration from RSpec, Cucumber, and Ruby, but tailored for the .NET and C# environment. It offers a more familiar style for .NET developers.

Check out the SpecFlow website for more information. You can find a silent screencast that introduces its syntax and workflow, as well as great resources to get started.

Interestingly, SpecFlow even seems to support Swedish, as noted here. Kudos to the SpecFlow team for their excellent work!

I plan to explore SpecFlow further as...

Read More

ASP.NET MVC, StructureMap, and … TDD?

I’ve been experimenting with ASP.NET MVC and StructureMap (an IOC container), and the integration has been quite smooth. For guidance on combining StructureMap with ASP.NET MVC, check out Elijah Manor’s blog post. Be cautious of the favicon issue.

I’m also using NHibernate and Fluent NHibernate for a cleaner configuration compared to XML. If you need to set specific properties in Fluent NHibernate, this Stack Overflow thread provides a helpful example. Additionally, the TekPub NHibernate series and Kona project examples are great resources.

Now, onto the topic of TDD. While I appreciate TDD as my preferred coding method, I’m grappling with its application at a higher level. For example, how do I decide when to introduce a repository or an IOC container, and should I TDD the IOC code?

I’ve sought advice from the Swedish ALT.NET group and found that BDD and the concept of...

Read More

Visual Studio 2010 web.config transformation

I happened to run into a feature I didn’t know of… Visual Studio 2010 (beta still… soon RC) includes a function for managing different .config-files for different environments. And support for transforming them on build/publish.

Here is a MSDN-article that introduces the concept and use it. And here is an article on the subject.

Pretty cool since up to now you’ve had to do it manually with build-tasks… Not so trivial.

Read More

NUnit and the constraint based model

At the Elevate presentation yesterday I learned a lot about C#3/4 by Magnus

But as a side-effect I also picked up a nifty syntax for NUnit assertions. It’s called Constraint-based Assertion Model and has been around since NUnit 2.4. Which shows that I am a slow adopter… Sad.

OK – what’s the deal with it? It gives you a almost fluent interface to assertions. Here is an example on how to do a simple assertion in the old style:

And here is the same assertion in the Constraint-based version:

Now read it out loud; Assert… That … I … is equal to 10. Nice, isn’t it? I like that a lot.

Read More