我有一个数据库,我正在尝试将dapper与Core Identity一起使用来查询数据库。 但我被困在这一点上。我正在使用来自身份用户界面的用户用户:
public class User : IdentityUser
{
}
与制作自定义用户存储的 CRUD 与 dapper。
public class UserStore : IUserStore<User>
{
private readonly string connectionString;
public UserStore(IConfiguration configuration)
{
connectionString = configuration.GetValue<string>("DBInfo:ConnectionString");
}
internal IDbConnection Connection
{
get
{
return new SqlConnection(connectionString);
}
}
public Task<IdentityResult> CreateAsync(User user, CancellationToken cancellationToken)
{
**// HOW TO I RETURN A USER WITH DAPPER HERE?**
}
public Task<IdentityResult> DeleteAsync(User user, CancellationToken cancellationToken)
{
throw new NotImplementedException();
}
public void Dispose()
{
throw new NotImplementedException();
}
public Task<User> FindByIdAsync(string userId, CancellationToken cancellationToken)
{
throw new NotImplementedException();
}
public Task<User> FindByNameAsync(string normalizedUserName, CancellationToken cancellationToken)
{
throw new NotImplementedException();
}
public Task<string> GetUserIdAsync(User user, CancellationToken cancellationToken)
{
throw new NotImplementedException();
}
public Task<string> GetUserNameAsync(User user, CancellationToken cancellationToken)
{
throw new NotImplementedException();
}
public Task<IdentityResult> UpdateAsync(User user, CancellationToken cancellationToken)
{
throw new NotImplementedException();
}
谢谢!
请看一下我最近上传到 GitHub 上的一个项目 - https://github.com/giorgos07/Daarto 这正是您所需要的。