Open Generics

Mar 16, 2011 at 5:03 AM

It appears that there is no support for open generics in Munq.  Is this something that is planned for a future release, or is there any way to implement it now?

Coordinator
Mar 18, 2011 at 3:23 AM

Could you please explain what you are trying to do, preferrably with an example.  I'm not sure what you are hoping to accomplish.

 

Matthew

Mar 18, 2011 at 5:00 AM

For example with some frameworks I could wire up a generic class without specifying the generic parameter, such as:

ioc.Register(typeof(IRepository<>), typeof(Repository<>));

This could be used to instantiate any valid IRepository type like:

var myDomainObject = ioc.Resolve<IRepository<MyDomainObject>>();

This way I wouldn't need to modify any bootstrapping code as new repository types are added.
Coordinator
Mar 18, 2011 at 10:33 PM
A very interesting idea. Unfortunately, it won’t make it into this weekend’s release.
Matthew