Auto registering complex generic types in StructureMap -



Auto registering complex generic types in StructureMap -

i need help in auto-registering generics using structuremap. here scenario:

public class object<t> { } public interface ibehvior<t> { void dosomething(t t); } public class behvior<t> : ibehvior<object<t>> { public void dosomething(object<t> t) { } }

what want accomplish like:

var x = objectfactory.getinstance<ibehavior<object<int>>();

but when run statement, gives me error no default instance configured. in structuremap configuration i've used

connectimplementationstotypesclosing(typeof(ibehavior<>))

but still doesn't work!

note worked fine if didn't have object. example, if have:

public class intbehavior : ibehavior<int> { }

everything works fine. when replace int generic type, doesn't work!

any ideas?

ok discovered solution here:

http://lostechies.com/jimmybogard/2010/01/07/advanced-structuremap-custom-registration-conventions-for-partially-closed-types/

structuremap

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

c# - Can ProtoBuf-Net deserialize to a flat class? -

javascript - Change element in each JQuery tab to dynamically generated colors -