コード例 #1
0
 public virtual void CreateOrUpdateAll(IEnumerable <T> entities)
 {
     try
     {
         Database.InsertOrReplaceAll(entities);
     }
     catch (Exception e)
     {
         var exc = new RepoException(string.Format("Could not create or update multiple {0}", typeof(T)), e);
         _logger.Log(exc, LogType.ERROR);
         throw exc;
     }
 }
コード例 #2
0
 public virtual void CreateOrUpdate(T entity)
 {
     try
     {
         Database.InsertOrReplace(entity);
     }
     catch (Exception e)
     {
         var exc = new RepoException(string.Format("Could not create or update {0}", typeof(T)), e);
         _logger.Log(exc, LogType.ERROR);
         throw exc;
     }
 }
コード例 #3
0
 public void ClearTable()
 {
     try
     {
         Database.DeleteAll <T> ();
     }
     catch (Exception e)
     {
         var exc = new RepoException(string.Format("Could not clear table for {0}", typeof(T)), e);
         _logger.Log(exc, LogType.ERROR);
         throw exc;
     }
 }
コード例 #4
0
 public virtual void UpdateAll(IEnumerable <T> entities)
 {
     try
     {
         Database.UpdateAll(entities);
     }
     catch (Exception e)
     {
         var exc = new RepoException(string.Format("Could not update {0}", typeof(T)), e);
         _logger.Log(exc, LogType.ERROR);
         throw exc;
     }
 }
コード例 #5
0
 public virtual IList <T> ReadAll()
 {
     try
     {
         var entities = Database.Query <T> ().ToList();
         return(entities);
     }
     catch (Exception e)
     {
         var exc = new RepoException(string.Format("Could not read all {0}", typeof(T)), e);
         _logger.Log(exc, LogType.ERROR);
         throw exc;
     }
 }
コード例 #6
0
        public void ClearAllDatabaseContent()
        {
            try
            {
                // TODO: Add Tables
//				Database.CreateTable<CardAction>();

                // TODO: Remove Tables
//				Database.DeleteAll<CardAction>();
            }
            catch (Exception e)
            {
                var exc = new RepoException("Could not clear all database content", e);
                _logger.Log(exc, LogType.ERROR);
                throw exc;
            }
        }