public static long?GetCheckSUMDirections() { try { using (DirectionContext context = new DirectionContext()) { long checksum = context.Checksums.FromSql("CHECKSUM TABLE Directions").AsNoTracking().FirstOrDefault().Hash; return(checksum); } } catch (Exception e) { Error = e.Message; return(null); } }
/// <summary> /// Добавить записи в таблицу бд /// </summary> /// <param name="directions">Список направлений</param> public static bool InsertDirections(SortedSet <Direction> directions) { try { using (DirectionContext context = new DirectionContext()) { context.Database.ExecuteSqlCommand("TRUNCATE TABLE Directions"); context.Directions.AddRange(directions); context.SaveChanges(); return(true); } } catch (Exception e) { Error = e.Message; return(false); } }