Hello. I am trying to update my records but only the table I am updating with UpdateAsync will update. I use AutoMapper to map to DTOs, the fields seem to map alright. The insertion is working and I can see data in all three tables. So, I am trying to update my recipeRepository, but only the recipe table is being updated entity classes:
public class Recipe : Entity, ISoftDelete, IHasCreationTime, IHasModificationTime
{
[Key]
[Column("id")]
public override int Id { get; set; }
public string recipe_name { get; set; }
public string recipe_dish { get; set; }
public Nullable<float> recipe_cooking_time { get; set; }
public Nullable<float> recipe_preparation_time { get; set; }
public string recipe_author { get; set; }
public string recipe_description { get; set; }
public string recipe_image { get; set; }
public virtual ICollection<Ingredient> Ingredients { get; set; }
public bool IsDeleted { get; set; }
public DateTime CreationTime { get; set; }
public DateTime? LastModificationTime { get; set; }
}
}
public class Product : Entity
{
[Key]
[Column("id")]
public override int Id { get; set; }
public string product_name { get; set; }
public virtual ICollection<Ingredient> Ingredients { get; set; }
}
public class Ingredient : Entity
{
[Key]
[Column("id")]
public override int Id { get; set; }
public Nullable<float> ingredient_quantity { get; set; }
public string ingredient_unit { get; set; }
public string ingredient_notes { get; set; }
[Required]
public int ingredient_recipe_id { get; set; }
[Required]
public int ingredient_product_id { get; set; }
[ForeignKey("ingredient_product_id")]
public virtual Product Product { get; set; }
[ForeignKey("ingredient_recipe_id")]
public virtual Recipe Recipe { get; set; }
}
}
I am using mysql provider, maybe it's the provider's fault?