Exemplo n.º 1
0
        public void Update(T item)
        {
            var orig = Get(item);

            _memberResolver.ApplyChanges(orig, item);
            _collection.Save(orig);
            AutoSaveIfAutoSaveEnabled();
        }
Exemplo n.º 2
0
        public virtual void Update(T item)
        {
            string           key     = GetItemKey(item);
            IDocumentSession session = GetSession();
            var current = session.Load <T>(key);

            _memberResolver.ApplyChanges(current, item);
            session.Store(current);
            if (AutoSave)
            {
                SaveChanges();
            }
        }
Exemplo n.º 3
0
 /// <summary>
 ///     Instructs the underlying DbSet to attach the given item, and, if <see cref="AutoSave" />
 ///     is
 ///     <value>true</value>
 ///     , applies the change to the underlying store.
 /// </summary>
 /// <param name="item"></param>
 public virtual void Update(T item)
 {
     _dbSet.Attach(item);
     if (_dbContext != null)
     {
         _dbContext.Entry(item).State = EntityState.Modified;
     }
     else
     {
         T actual = Get(item);
         _memberResolver.ApplyChanges(actual, item);
     }
     if (AutoSave)
     {
         SaveChanges();
     }
 }