我发现了一些与我发布的问题类似的问题,但我没有从他们那里得到我真正需要的东西。我仍在努力实现我的CustomMembershipProvider
using Microsoft Unity DI
。
自定义会员:
public class CustomMembershipProviderService : MembershipProvider
{
private readonly IUserService _userService;
public CustomMembershipProviderService(IUserService userService)
{
this._userService = userService;
}
public override string ApplicationName
{
...
用户服务:
public class UserService : IUserService
{
private readonly IUserRepository _repository;
private readonly IUnitOfWork _unitOfWork;
public UserService(IUserRepository repository, IUnitOfWork unitOfWork)
{
this._repository = repository;
this._unitOfWork = unitOfWork;
}
...
帐户控制器:
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;
}
...
如何为我的MembershipProvider
班级创建一个界面?
我试过了:
public interface ICustomMembershipProvider : MembershipProvider
但我认为这不起作用,所以我被卡住了,不知道如何MembershipProvider
使用我的存储库、UoW、服务和 Unity DI来实现