public override void Save(IList <RowData> rowsData) { using (EventLogContext _context = EventLogContext.Create(_databaseOptions, _databaseActions)) { if (_maxPeriodRowData == DateTime.MinValue) { _maxPeriodRowData = _context.GetRowsDataMaxPeriod(_system); } List <Database.Models.RowData> newEntities = new List <Database.Models.RowData>(); foreach (var itemRow in rowsData) { if (itemRow == null) { continue; } if (_maxPeriodRowData != DateTime.MinValue && itemRow.Period.DateTime <= _maxPeriodRowData) { if (_context.RowDataExistOnDatabase(_system, itemRow)) { continue; } } newEntities.Add(new Database.Models.RowData(_system, itemRow, _referencesCache)); } _context.AddRange(newEntities); _context.SaveChanges(); } }
public override void UpdateReferences(ReferencesData data) { using (EventLogContext _context = EventLogContext.Create(_databaseOptions, _databaseActions)) { _context.FillReferencesToSave(_system, data); _context.SaveChanges(); if (_referencesCache == null) { _referencesCache = new ReferencesDataCache(_system); } _referencesCache.FillByDatabaseContext(_context); } }