You cannot enter something solid. I'm sorry. No DI infrastructure supports this. In your constructor, you hardcoded the instance, so this is no longer an inverse of control. To perform a control inversion, you need to define your layers as clearly as possible:
public class EFRoleProvider: RoleProvider
{
private readonly IContextFactory _contextFactory;
public EFRoleProvider(IContextFactory contextFactory)
{
_contextFactory = contextFactory;
}
}
Now go and configure your DI infrastructure.
source
share