Esempio n. 1
0
 /// <summary>
 /// Relays call of Save to data source, if the data
 /// source supports the Load operation
 /// </summary>
 public async void Save(bool suppressException = true)
 {
     if (_supportedOperations.Contains(PersistencyOperations.Save))
     {
         await _persistentSource.Save(CreateDTOList(_collection.All));
     }
     else
     {
         if (!suppressException)
         {
             throw new NotSupportedException();
         }
     }
 }
Esempio n. 2
0
        /// <inheritdoc />
        /// <summary>
        /// Relays call of Save to data source, if the data
        /// source supports the Load operation
        /// </summary>
        public async Task SaveAsync(bool suppressException = true)
        {
            if (_supportedOperations.Contains(PersistencyOperations.Save))
            {
                SaveBegins?.Invoke();
                await _persistentSource.Save(CreatePersistentDataObjects(_collection.All));

                SaveEnds?.Invoke();
            }
            else
            {
                if (!suppressException)
                {
                    throw new NotSupportedException();
                }
            }
        }