Configuring the Castle Windsor container

Just recently I stumbled across a code sample, which showed how to use the Registry-class of StructureMap to register classes to the container. Basically this looks like this:

public class RepositoryRegistry : Registry
{
    public RepositoryRegistry ()
    {
        For(typeof (IRepository<>)).Use(typeof (DummyRepository<>));
    }
}
container = new StructureMap.Container(x =>
{
    x.AddRegistry(new RepositoryRegistry());
});

So I though, this must also be possible in Castle Windsor – and indeed! So the equivalent in Castle Windsor would look like this:

using System;
using System.Reflection;
using Castle.MicroKernel;
using Castle.MicroKernel.Registration;
using Castle.Windsor;
public class RepositoryInstaller:IWindsorInstaller
{
    public void Install(IWindsorContainer container, IConfigurationStore store)
    {
        container.Register(AllTypes
                               .Pick()
                               .FromAssembly(Assembly.GetExecutingAssembly())
                               .If(s => s.Name.EndsWith("Repository"))
                               .Configure(c => c.LifeStyle.Singleton));
    }
}
container = new WindsorContainer().Install(
    new NHibernateInstaller(sessionSource),
    new RepositoryInstaller(),
    new PresenterInstaller()
);

This is really cool, too bad I didn’t discover that before 🙂

Integrated Windows Authentication in Mantis (Updated to Mantis 1.2.1)

In a previous post I described the necessary steps, to enable integrated windows authentication when working with Mantis on a linux box. These modifications where targeted against the 1.1.0a2 release of Mantis. In the meantime a lot of development has been done on Mantis, so that my original post isn’t quite accurate anymore. This post will enable you to use integrated security with the current 1.2.1 release of Mantis.

While the basic setup is somewhat unchanged, only the file core/authentication_api.php needs to be changed. The login.php doesn’t need to be changed anymore, since the functionallity moved to the authentication_api.php.

I added an updated patchfile to apply the necessary changes to the file.

Naming of columns in SharePoint lists

You have to watch out, when choosing your column-names in SharePoint lists. A column can have any name and can easily been changed.

Good to know is the fact, that a column has actually two names. An internal name and a display name. When a new column is being created the choosen name is being used for both names, the internal as well as the display name. If you change the column name later on, you actually only change the display name, not the internal name.

So far, so good. If you create a new column called “Employee Name” then the internal name will be actually “Employee_x0020_Name”. This doesn’t look good and doesn’t feeld good when working with CAML queries or XSLT in SharePoint Designer.

A better approach would be to chose “EmployeeName” as the column name and then change the display name to “Employee Name” later on. This way you will get a nice and clean internal column name.