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); } }
public static void Update <TEntity>(this IPersistenceStorage persistenceStorage, IEnumerable <TEntity> toUpdate) where TEntity : class, IEntity { persistenceStorage.Save(Array.Empty <TEntity>(), toUpdate, Array.Empty <TEntity>()); }
public static void Delete <TEntity>(this IPersistenceStorage persistenceStorage, params TEntity[] toDelete) where TEntity : class, IEntity { persistenceStorage.Save(Array.Empty <TEntity>(), Array.Empty <TEntity>(), toDelete); }
public static void Insert <TEntity>(this IPersistenceStorage persistenceStorage, params TEntity[] toInsert) where TEntity : class, IEntity { persistenceStorage.Save(toInsert, Array.Empty <TEntity>(), Array.Empty <TEntity>()); }