Closed JanWosnitza closed 11 years ago
For anybody interessted my "workaround" is:
var assembly = typeof( __Module__ ).Assembly;
foreach ( var type in assembly.GetTypes() )
{
if ( !type.IsClass ||
type.IsAbstract )
continue;
var i = type.GetInterfaces().FirstOrDefault( t => t.Name == "I" + type.Name );
if ( ( i == null ) ||
( i.Assembly != assembly ) )
continue;
if ( type.IsGenericTypeDefinition &&
i.IsGenericType &&
i.GetGenericArguments().All( t => t.IsGenericParameter && ( t.DeclaringType == type ) ) )
i = i.GetGenericTypeDefinition();
this.Bind( i ).To( type );
}
It is supported:
.FromThisAssembly().IncludingNonePublicTypes().SelectAllClasses().BindDefaultInterface()
Oh thx :) now this ticket is at least some documentation ^^
This will not bind
Example
toIExample
. Is this on purpose?I expeted this to be working, since IExample could be used by anyone. The concrete implementation of the interface is not important to any users of the interface.
I really would like to have this setup working. (I would call this "injection in perfection" lolz)