So I've wired up my open generic plugin in StructureMap like so
scan.ConnectImplementationsToTypesClosing(typeof(IRepository<>));
But still get the dreaded
No Default Instance defined for PluginFamily KharaSoft.Utils.IRepository`1[[KharaSoft.App.Core.DomainObject, KharaSoft.App.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]
I debug after the Container is initialized and see that it does indeed have an instance of RepositoryBase<> registered so it knows what I want done, but it won't close it for me. Is there something I'm missing here?
So I'm not sure if this is the "best" way but this is what I found that works. I had to explicitly register the open implementation of the plugin like this:
See I didn't want to close the generic directly in all cases. So now my MVC controller can take a dependency like so
And StructureMap will close the dependency with an instance of RepositoryBase