Beispiel #1
0
 public void Add(CoreTimeoutData timeout)
 {
     using (var session = DocumentStore.OpenSession())
     {
         session.Store(new Timeout(timeout));
         session.SaveChanges();
     }
 }
Beispiel #2
0
        public bool TryRemove(string timeoutId, out CoreTimeoutData timeoutData)
        {
            using (var session = DocumentStore.OpenSession())
            {
                session.Advanced.UseOptimisticConcurrency = true;

                var timeout = session.Load <Timeout>(timeoutId);
                if (timeout == null)
                {
                    timeoutData = null;
                    return(false);
                }

                timeoutData = timeout.ToCoreTimeoutData();
                session.Delete(timeout);
                session.SaveChanges();
                return(true);
            }
        }