C
C#8mo ago
xyrile

EF Core how to add two same object in 1 model

public int UserId { get; set; }
[ForeignKey("UserId")]
public AccountModel Account { get; set; } = new();
public int MarkAsPaidById { get; set; }
[ForeignKey("MarkAsPaidById")]
public AccountModel MarkAsPaidByAccount { get; set; } = new();
public int UserId { get; set; }
[ForeignKey("UserId")]
public AccountModel Account { get; set; } = new();
public int MarkAsPaidById { get; set; }
[ForeignKey("MarkAsPaidById")]
public AccountModel MarkAsPaidByAccount { get; set; } = new();
[Table("Accounts")]
[PrimaryKey("UserId")]
public class AccountModel
{
public int UserId { get; set; }
public string Username { get; set; } = string.Empty;
public string Password { get; set; } = string.Empty;
}
[Table("Accounts")]
[PrimaryKey("UserId")]
public class AccountModel
{
public int UserId { get; set; }
public string Username { get; set; } = string.Empty;
public string Password { get; set; } = string.Empty;
}
2 Replies
Aaron
Aaron8mo ago
hello i dont understand your question
Angius
Angius8mo ago
?
Want results from more Discord servers?
Add your server