views:

28

answers:

0

Hey all,

I'm using iBatis.net as my ORM and Structuremap for my IOC library. I'm currently trying to figure out how to get iBatis to use the IOC container to create objects instead of relying on the default constructor. Is there a way that anyone knows of to enhance iBatis in such a way?

Currently as a work around I'm doing a hack of a way of writing constructors for my objects:

public class EntityA
{
    public EntityA() : this(ServiceLocator.Current.Resolve<IDependencyA>()) {}

    public EntityA(IDependencyA dependencyA)
    {
        DependencyA = dependencyA;
    }

    protected readonly IDependencyA DependencyA;
}