Lorenz Cuno Klopfenstein

Articles from December 2009

I recently updated the source code to my Babil project in order to port it to the new ASP.NET MVC 2 beta. I decided I could as well update all other libraries the project depends on, which have been updated too in the meantime.

This took some time, but if you want to create a new website project based on ASP.NET MVC and NHibernate, here's the latest bits:

  • Get the ASP.NET MVC 2 beta source code from Codeplex and compile it. Remember to also compile the Microsoft.Web.Mvc.dll library that contains some useful code.
  • Get NHibernate 2.1, the latest release of the popular O/RM library.
  • Get the latest MySQL .NET connector (6.1.3) if you use NHibernate against a MySQL database.
  • If you use NHibernate.Search for full text indexing:
  • If you use NHibernate.Validator, get the source code and compile that too against the latest NHibernate DLL.
  • For your dependency injection needs, you might use Autofac. In that case, you also need to download the latest stable Autofac library and the source code of the web integration library. This integration library must be compiled using the beta version of ASP.NET MVC 2.

That's it, now throw everything in the /Bin folder and - crossing fingers - you should be able to finally write some own code.  :)

Posted on Wednesday, December 16, 2009
588 Views
3 comments posted

I have been implementing a simple and easy to use IoC library: I need a simple solution and big frameworks like Spring.net offer way too much stuff (even Autofac is getting huge). My implementation is composed of some basic container, some simple instantiation logic and some stuff to do automatic property injection. Nothing more.

In order to keep a collection of all singleton instances registered in the IoC container, I needed a thread safe dictionary implementation. There are a lot of discussions about how to do it right: the agreed point is that it isn't simple, mainly because you're working at the wrong level of abstraction.

Either you get a lock on each single IDictonary method, that would result in tons of locking with potentially incoherent results between one call and the other. Or you expose a more complex interface, like they did with ASP.NET MVC's RouteTable collection, and leave locking to the user.

I decided to do something in between, using ReaderWriterLockSlim from .NET 3.5 instead of a simple lock{} and writing a fine grained IDictionary implementation while also exposing some high level methods to obtain coherent and really thread safe results.

More...

Posted on Friday, December 18, 2009
Tagged as
2476 Views
458 comments posted
Back to Klopfenstein.net
Clemens Klopfenstein Serena Kiefer Lukas Tiberio Klopfenstein Lorenz Cuno Klopfenstein
English German