I have found a few questions similar to the one I'm posting but I'm not getting from them what I really need.
I'm still struggling to implement my CustomMembershipProvider
using Microsoft Unity DI
.
Custom Membership:
public class CustomMembershipProviderService : MembershipProvider
{
private readonly IUserService _userService;
public CustomMembershipProviderService(IUserService userService)
{
this._userService = userService;
}
public override string ApplicationName
{
...
User Service:
public class UserService : IUserService
{
private readonly IUserRepository _repository;
private readonly IUnitOfWork _unitOfWork;
public UserService(IUserRepository repository, IUnitOfWork unitOfWork)
{
this._repository = repository;
this._unitOfWork = unitOfWork;
}
...
AccountController:
public class AccountController : Controller
{
// next line is what I don't feel too sure about what to do?
// shouldn't my controller constructor use an Interface as its property?
private readonly CustomMembershipProviderService _customMembershipProviderService;
public AccountController(CustomMembershipProviderService customMembershipProviderService)
{
this._customMembershipProviderService = customMembershipProviderService;
}
...
How can I create an interface for my MembershipProvider
class?
I've tried:
public interface ICustomMembershipProvider : MembershipProvider
but I don't think that works, so I'm stuck, and don't know how to implement the MembershipProvider
using my repositories, UoW, services, and Unity DI
AccountController
would take theICustomMembershipProvider
as a parameter in the constructor? – Hundredweight