C# 如何从IdentityDbContext和ApplicationDbContext连接表

C# 如何从IdentityDbContext和ApplicationDbContext连接表,c#,linq,asp.net-identity,C#,Linq,Asp.net Identity,如何将AspNetUsers加入到我的表中,其中电子邮件是从AspNetUsers表确认的 从确认电子邮件的表AspNetUsers中选择用户 我的桌子 您可以执行以下操作: UserAccountListViewModel model = new UserAccountListViewModel(); model.UserAccounts = db.UserAccounts.Where(ua => users.Contains(ua.Id)).ToList(); // Here `ua

如何将AspNetUsers加入到我的表中,其中电子邮件是从AspNetUsers表确认的

从确认电子邮件的表AspNetUsers中选择用户

我的桌子

您可以执行以下操作:

UserAccountListViewModel model = new UserAccountListViewModel();

model.UserAccounts = db.UserAccounts.Where(ua => users.Contains(ua.Id)).ToList(); // Here `ua.Id` is the column of `UserAccount` table that you are comparing against the Id of Users table.

您正在尝试获取用户列表中存在的用户帐户,不是吗?@TanvirArjel是的,先生
ApplicationDbContext db = new ApplicationDbContext();
UserAccountListViewModel model = new UserAccountListViewModel();
model.UserAccounts = db.UserAccounts.ToList();
UserAccountListViewModel model = new UserAccountListViewModel();

model.UserAccounts = db.UserAccounts.Where(ua => users.Contains(ua.Id)).ToList(); // Here `ua.Id` is the column of `UserAccount` table that you are comparing against the Id of Users table.