سلام با کد ذیل _userStore واسه من نال بر میگردونه
using System.Data.Entity;
using System.Threading.Tasks;
using Microsoft.AspNet.Identity.EntityFramework;
using SmartMarket.Core.Domain.Members;
using SmartMarket.Data;
namespace SmartMarket.Services.Members
{
/// <summary>
/// The ApplicationUserStore Class
/// </summary>
public class ApplicationUserStore : UserStore<User, Role, int, UserLogin, UserRole, UserClaim>, IApplicationUserStore
{
#region Fields (1)
private readonly IDbSet<User> _userStore;
#endregion Fields
#region Constructors (2)
/// <summary>
/// Initializes a new instance of the <see cref="ApplicationUserStore" /> class.
/// </summary>
/// <param name="dbContext">The database context.</param>
public ApplicationUserStore(DbContext dbContext) : base(dbContext) { }
/// <summary>
/// Initializes a new instance of the <see cref="ApplicationUserStore"/> class.
/// </summary>
/// <param name="context">The context.</param>
public ApplicationUserStore(IdentityDbContext context)
: base(context)
{
_userStore = context.Set<User>();
}
#endregion Constructors
#region Methods (2)
// Public Methods (2)
/// <summary>
/// Adds to previous passwords asynchronous.
/// </summary>
/// <param name="user">The user.</param>
/// <param name="password">The password.</param>
/// <returns></returns>
public Task AddToPreviousPasswordsAsync(User user, string password)
{
user.PreviousUserPasswords.Add(new PreviousPassword { UserId = user.Id, PasswordHash = password });
return UpdateAsync(user);
}
/// <summary>
/// Finds the by identifier asynchronous.
/// </summary>
/// <param name="userId">The user identifier.</param>
/// <returns></returns>
public override Task<User> FindByIdAsync(int userId)
{
return Task.FromResult(_userStore.Find(userId));
}
#endregion Methods
/// <summary>
/// Creates the asynchronous.
/// </summary>
/// <param name="user">The user.</param>
/// <returns></returns>
public override async Task CreateAsync(User user)
{
await base.CreateAsync(user);
await AddToPreviousPasswordsAsync(user, user.PasswordHash);
}
}
}