Trying to inject a repository into my CustomMembershipProvider
.
Let me start that I am not in fond of the Singleton
pattern or some other global public solutions.
Here is a sample of the CustomMemberhipProvider
public class CustomMembershipProvider : BaseMembershipProvider
{
private readonly UserRepository _userRepository;
public override void Initialize(string name, System.Collections.Specialized.NameValueCollection config)
{
// Magically pull the userrepository in here?
base.Initialize(name, config);
}
}
The only working example I found so far is to add a Factory
, which is yet-another-alternative for some global public
class.
- Is there nothing out there that allows me properly inject an object (
UserRepository
) to theCustomMembershipProvider
? - If not, is there a good alternative? I am not married to the CustomMembershipProvider, so if there is something else out there that allows me to use
[Authorize]
attributes in my controller, then I'm all for it.
Thanks a lot in advance!