Код: Выделить всё
public class TestExecution
{
[Key]
public int Id { get; set; }
public ParametersSet? ParametersSet { get; set; }
[ForeignKey("Environment")]
public required int EnvironmentId { get; set; }
public required Environment Environment { get; set; }
}
Код: Выделить всё
public class ParametersSet
{
[Key]
public int Id { get; set; }
// Other properties
[ForeignKey("TestExecutionId")]
public int TestExecutionId { get; set; }
public TestExecution TestExecution { get; set; }
}
Код: Выделить всё
public class Environment
{
[Key]
public int Id { get; set; }
// Other properties
public ICollection TestExecutions { get; set; } = new List();
}
Однако, от зависимого параметраSet до основного TestExecution, следует ли мне использовать требуемый вот так :
Код: Выделить всё
public class ParametersSet
{
[Key]
public int Id { get; set; }
[ForeignKey("TestExecutionId")]
public required int TestExecutionId { get; set; }
public required TestExecution TestExecution { get; set; }
}
Код: Выделить всё
public class TestExecution
{
[Key]
public int Id { get; set; }
public ParametersSet? ParametersSet { get; set; }
[ForeignKey("Environment")]
public required int EnvironmentId { get; set; }
public required Environment Environment { get; set; }
}
Подробнее здесь: https://stackoverflow.com/questions/791 ... avigations
Мобильная версия