我有一個數據庫和iam試圖使用核心身份的矮胖來查詢數據庫。但我堅持在這一點上。我使用的是用戶從identityUser的接口:如何使用ASP.Net核心身份的短小精靈?
public class User : IdentityUser
{
}
的一個製作自定義用戶商店CRUD用短小精悍。
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();
}
謝謝!
我建議你閱讀文檔:https://github.com/StackExchange/Dapper它基本上是'SqlConnection' /'IDbConnection'上的擴展庫。 –
你究竟在問什麼?如何根據我們尚未見過的數據庫結構編寫創建邏輯?這個問題太不清楚,而且答案太廣泛。 –
'公共任務 CreateAsync(用戶用戶,CancellationToken cancellationToken) { ** //如何在此返回用戶?** }' –
Javier