C#C
C#2y ago
56 replies
Elio

SQLITE EFcore saving value

Hi, i'm working on a project which have a SQLITE database. I'm using EFcore to managed it. I want to know if there is a way to automatically add/remove/update by tracking or idk all the variable in my list Widths.
Basically i want to call a methods
Save
that will add thickness if not added or add/remove/update elements in width a if thickness i already in the database.
public class Thickness
{
    #region Properties
    [Key]
    public long Id { get; set; }

    [Required]
    public long MaterialId { get; set; }

    [Required]
    public double Value { get; set; }

    public List<Width> Widths { get; set; } = new List<Width>();
}

[Table("Width")]
public class Width
{
    #region Properties
    [Key]
    public long Id { get; set; }

    [Required]
    public long ThicknessId { get; set; }

    [Required]
    public double Value { get; set; }
}
Was this page helpful?