私は次のスキーマを持っています:
public class Provider
{
[Key]
public int ProviderId { get; set; }
[ForeignKey("ProviderId")]
public ApplicationUser User;
public ICollection<ServiceProvider> Services { get; set; }
}
public class ApplicationUser : IdentityUser
{
public ApplicationUser() : base() { }
public string Name { get; set; }
public string Address { get; set; }
public string Photo { get; set; }
public string BusinessName { get; set; }
}
私のバックエンドでは、入力として電子メールがあり、その電子メールを持つプロバイダーがあるかどうかを確認しようとしています。次のコードを使用しようとしました:
if (context.Provider.Any(o => o.User.Email == input_mail) == false)
しかし、ヌルポインタ例外が発生しました..
linku構文を使用できることを知っています:
var q = from au in _context.ApplicationUser
join p in _context.Provider on au.Id equals p.ProviderId
where au.Email=input_mail;
モデルのコンテキストを使用してそれを行う方法はありますか? リンクの代わりに