I have the following user Store:
public class UserStoreService<T> : UserStore<T> where T : IdentityUser
{
public UserStoreService(MainDbContext context)
: base(context)
{
}
}
In my Startup, I need to bind this with a custom user from another library. I am trying to avoid to have to reference that library in my project altogether. I have the interfaces referenced and that is what I am using throughout the whole project to access properties and such. What I can't figure out is how to dynamically bind the following statement:
kernel.Bind<IUserStore<MyCustomUser>>().To<UserStoreService<MyCustomUser>>();
MyCustomUser extends IdentityUser
So there's two ways to achieve bindings without referencing the implementation-assembly directly:
kernel.Load(AppDomain.CurrentDomain.GetAssemblies())IBindingGeneratorin your case. -- of course you could also roll your own implementationA word of warning though, many would say that you should employ a composition root and hence you should actually reference the implementation assembly from and create the bindings in the composition root. See Mark Seemann's argumentation.