I've started using Shortbus, but I'm having some DLL versioning issues between the StructureMap.MVC5 package and Shortbus. Shortbus uses StructureMap 2.6.3 and the MVC5 package is using 2.6.3.
I've tried dependency redirection, but because of the MajorVersion change, Shortbus is causing me a problem.
Since it is an open source project I decided to try and upgrade Shortbus to vewrsion 3 of StructureMap.
I'm stuck on moving this old code:
[Test]
public void StructureMapResolveSingleInstance()
{
var registered = new Registered();
ObjectFactory.Initialize(i => i.Register(registered));
var resolver = new StructureMapDependencyResolver(ObjectFactory.Container);
var resolved = (Registered) resolver.GetInstance(typeof (Registered));
Assert.That(resolved, Is.EqualTo(registered));
}
..to version 3. The problem falls on Register and the fact that the ObjectFactory is now considered obsolete.
I assume I need to create my own ObjectFactory as per this answer: https://stackoverflow.com/a/25551005/119624
And include my own registry. Can anyone help me on my way with some code?