Beispiel #1
0
 public override void Update(TEntity item)
 {
     System.Data.Entity.Infrastructure.DbEntityEntry <TEntity> dbentityEntry = this.EFContext.Entry(item);
     if (dbentityEntry.State == System.Data.Entity.EntityState.Detached)
     {
         var     keys         = this.GetEntityKey <TEntity>(this.EFContext, item);
         TEntity attachedItem = this.DbSet.Find(keys);
         if (attachedItem == null)
         {
             this.DbSet.Attach(item);
             dbentityEntry.State = System.Data.Entity.EntityState.Modified;
         }
         else
         {
             this.EFContext.Entry(attachedItem).CurrentValues.SetValues(item);
         }
     }
 }