![](/img/trans.png)
[英]GetTable in ApplicationDbContext : IdentityDbContext<ApplicationUser>
[英]How to join tables from IdentityDbContext and ApplicationDbContext
如何將AspNetUsers加入到我的表中,從AspNetUsers表中確認電子郵件
從確認電子郵件的表AspNetUsers中選擇用戶
var context = new IdentityDbContext();
var users = context.Users.Where(d => d.EmailConfirmed == true).Select(d => d.Id).ToList();
我的桌子
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.
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.