C
C#3mo 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
aaron3mo ago
hello i dont understand your question
Angius
Angius3mo ago
?