Hello,
Is it possible to insert an entity with child entities? I have an exception saying that it can't insert explicit value on identity (autoincrement) colum. These are my clases:
` public partial class Maestro
{
[Key]
public int Id { get; set; }
[StringLength(50)]
public string Nombre { get; set; }
[InverseProperty("IdNavigation")]
public virtual Detalle Detalle { get; set; }
}
public partial class Detalle
{
[Key]
public int Id { get; set; }
[StringLength(50)]
public string Nombre { get; set; }
public int MaestroId { get; set; }
[ForeignKey("Id")]
[InverseProperty("Detalle")]
public virtual Maestro IdNavigation { get; set; }
}
And this is the json request: {
"Id": 0,
"Nombre": "MasterName1",
"Detalle": {
"Id": 0,
"Nombre": "DetailName1",
"MaestroId": 0
}
}`
It would be great an example of .net 6 WebAPI controller with the most common cases of InsertOrUpdate with new or existing Master and new, existing or omited so deleted child entities.
If the example includes an equality comparer with throught key anotation would be awesome.
Hello, Is it possible to insert an entity with child entities? I have an exception saying that it can't insert explicit value on identity (autoincrement) colum. These are my clases:
` public partial class Maestro { [Key] public int Id { get; set; } [StringLength(50)] public string Nombre { get; set; }
And this is the json request:
{ "Id": 0, "Nombre": "MasterName1", "Detalle": { "Id": 0, "Nombre": "DetailName1", "MaestroId": 0 } }`It would be great an example of .net 6 WebAPI controller with the most common cases of InsertOrUpdate with new or existing Master and new, existing or omited so deleted child entities.
If the example includes an equality comparer with throught key anotation would be awesome.
Thanks in advance.