How to add custom table in ASP.NET IDENTITY?(如何在 ASP.NET IDENTITY 中添加自定义表?)
问题描述
我在我的 Web 表单应用程序上使用 ASP.NET Identity.以下是我当前的身份表:
I'm using ASP.NET Identity on my web form application. Below is my current identity tables:
- Role
- User
- UserClaim
- UserLogin
- UserRole
我需要添加一个新表来存储其他信息.
I need to add a new table to store additional information.
新表中的字段:
- 用户登录 ID (PK)
- 用户 ID (FK)
- IP 地址
- 登录日期
如何添加这个自定义表格?我知道如何在现有表中添加自定义字段,但我不知道如何实现.
How can I add this custom table? I know how to add custom fields inside existing table but I don't know how to achieve this.
感谢您为解决我的问题所做的努力.
I appreciate your efforts in reaching a solution for my problem.
推荐答案
public class ApplicationUser : IdentityUser
{
public virtual ICollection<UserLog> UserLogs { get; set; }
}
public class UserLog
{
[Key]
public Guid UserLogID { get; set; }
public string IPAD { get; set; }
public DateTime LoginDate { get; set; }
public string UserId { get; set; }
[ForeignKey("UserId")]
public virtual ApplicationUser User { get; set; }
}
public System.Data.Entity.DbSet<UserLog> UserLog { get; set; }
这篇关于如何在 ASP.NET IDENTITY 中添加自定义表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何在 ASP.NET IDENTITY 中添加自定义表?
- 输入按键事件处理程序 2022-01-01
- C# 中多线程网络服务器的模式 2022-01-01
- WebMatrix WebSecurity PasswordSalt 2022-01-01
- 在哪里可以找到使用中的C#/XML文档注释的好例子? 2022-01-01
- MoreLinq maxBy vs LINQ max + where 2022-01-01
- 带有服务/守护程序应用程序的 Microsoft Graph CSharp SDK 和 OneDrive for Business - 配额方面返回 null 2022-01-01
- 良好实践:如何重用 .csproj 和 .sln 文件来为 CI 创建 2022-01-01
- C#MongoDB使用Builders查找派生对象 2022-09-04
- Web Api 中的 Swagger .netcore 3.1,使用 swagger UI 设置日期时间格式 2022-01-01
- 如何用自己压缩一个 IEnumerable 2022-01-01
