How can I resolve an instance based on a open generic type?

93 views Asked by At

Currently I'm trying to reimplement some code code written in Castle Windsor in structuremap.

This code:

Component.For(typeof(IMongoCollection<>))
  .UsingFactoryMethod(
   (k, c) => MongoResolver.ResolveCollection(k, c.RequestedType)));

Does the following: When IMongoCollection is being called, resolve the concrete collection.

I tried to do this in structuremap with:

For(typeof(IMongoCollection<>)).Use("test", x =>
{
     SOME MAGIC!
}); 

But I cant figure out what to do in the magic part.

0

There are 0 answers