Exemplo n.º 1
0
 public static void WriteToDatabase <TEntity>(
     IEnumerable <TEntity> insertedNew,
     IEnumerable <TEntity> updatedNew,
     IEnumerable <TEntity> deletedIds,
     IPersistenceStorage persistenceStorage,
     bool checkUserPermissions,
     ISqlUtility sqlUtility,
     out Exception saveException,
     out RhetosException interpretedException)
     where TEntity : class, IEntity
 {
     try
     {
         persistenceStorage.Save(insertedNew, updatedNew, deletedIds);
         saveException        = null;
         interpretedException = null;
     }
     catch (NonexistentRecordException nre)
     {
         saveException        = null;
         interpretedException = null;
         if (checkUserPermissions)
         {
             throw new ClientException(nre.Message);
         }
         else
         {
             ExceptionsUtility.Rethrow(nre);
         }
     }
     catch (SqlException e)
     {
         saveException        = e;
         interpretedException = sqlUtility.InterpretSqlException(saveException);
     }
 }
Exemplo n.º 2
0
 public static void Update <TEntity>(this IPersistenceStorage persistenceStorage, IEnumerable <TEntity> toUpdate) where TEntity : class, IEntity
 {
     persistenceStorage.Save(Array.Empty <TEntity>(), toUpdate, Array.Empty <TEntity>());
 }
Exemplo n.º 3
0
 public static void Delete <TEntity>(this IPersistenceStorage persistenceStorage, params TEntity[] toDelete) where TEntity : class, IEntity
 {
     persistenceStorage.Save(Array.Empty <TEntity>(), Array.Empty <TEntity>(), toDelete);
 }
Exemplo n.º 4
0
 public static void Insert <TEntity>(this IPersistenceStorage persistenceStorage, params TEntity[] toInsert) where TEntity : class, IEntity
 {
     persistenceStorage.Save(toInsert, Array.Empty <TEntity>(), Array.Empty <TEntity>());
 }