Exemplo n.º 1
0
        public static async Task <bool> RevertGenerationAsync(this SQLiteDatabase database)
        {
            IGeneration generation = await database.GetCurrentGenerationAsync();

            if (generation.Number <= 1)
            {
                return(false);
            }

            // Delete the current generation.

            await database.DeleteGenerationAsync(generation);

            generation = await database.GetCurrentGenerationAsync();

            // Update the end timestamp of the previous generation so that it is now the current generation.

            generation.EndDate = DateUtilities.GetDateFromTimestamp(DateUtilities.GetMaxTimestamp());

            await database.UpdateGenerationAsync(generation);

            return(true);
        }