0

I am using MVC with Entity Framework and I have a table that tracks daily events in a hotel atmosphere. These events change daily such as who cleans a room and the time of the cleaning. The table is fine as is but what I would like to do is to save a copy of the table on a daily basis. I have read in this forum that serializing a list of table entries is not a good idea (How to store a list in a column of a database table). How do I go about saving the table data on a daily basis if not using a list of the table entries?

This is my units class/table

    public class Units
{
    [Key]
    [Required]
    public int UnitId { get; set; }
    public int UnitNumber { get; set; }
    public string UnitType { get; set; }
    public string Status { get; set; }   
    public bool Checkout { get; set; }  
    public bool isEmpty { get; set; }           
    public Employees Housekeeper { get; set; }
    public DateTime? CleanStart { get; set; }
    public DateTime? CleanEnd { get; set; }
    public bool isClean { get; set; }
    public Employees Laundry { get; set; }
    public DateTime? LaundryTime { get; set; }
    public bool isLaundry { get; set; }
    public Employees QualityControl { get; set; }
    public DateTime? QCStart { get; set; }
    public DateTime? QCEnd { get; set; }
    public bool isQC { get; set; }
    public Employees Maintenance { get; set; }
    public DateTime? MaintStart { get; set; }
    public DateTime? MaintEnd { get; set; }
    public bool isMaint { get; set; }
    public string Comments { get; set; }
    public string Color { get; set; }


}
Bob H.
  • 1
  • Why not just do a scheduled database backup or replication? – Chris Pratt Jul 25 '17 at 18:22
  • 1
    Or add a date column to the table so you know what date any given row is for. This is a classic xy problem. – Sean Lange Jul 25 '17 at 18:25
  • @SeanLange, the problem with adding the date is that I am using the class as the basis for an interactive table allowing users to update the data on the 40 Unit objects. – Bob H. Jul 25 '17 at 18:47
  • Well that didn't explain anything about why you are trying to store relational data (or perhaps multiple rows) in a single tuple. Honestly it sounds like to me like your data structure is causing you this issue. And refactoring your tables into a better design would eliminate the pain you are currently facing. – Sean Lange Jul 25 '17 at 19:01

0 Answers0