Solution for: Store update, insert, or delete statement affected an unexpected number of rows (0)

Solution:

try {
    context.SaveChanges();
} catch (OptimisticConcurrencyException) {
    context.Refresh(RefreshMode.ClientWins, db.Articles);
    context.SaveChanges();
}

Its better you update your save method like this..... In case you calling savechange() method of entity context after every addobject and deleteobject or modification :

public void Save(object entity)
{
    using (var transaction = Connection.BeginTransaction())
    {
        try
        {
            SaveChanges();
            transaction.Commit();
         }
         catch (OptimisticConcurrencyException)
         {
             if (ObjectStateManager.GetObjectStateEntry(entity).State == EntityState.Deleted || ObjectStateManager.GetObjectStateEntry(entity).State == EntityState.Modified)
                    this.Refresh(RefreshMode.StoreWins, entity);
              else if (ObjectStateManager.GetObjectStateEntry(entity).State == EntityState.Added)
                    Detach(entity);
              AcceptAllChanges(); 
              transaction.Commit();
          }

    }
}

It's because you have SET NOCOUNT ON.
The EF SQL Statement that it generates ALWAYS adds a clause of where @@ROWCOUNT > 0 and [ID] = scope_identity() (for example).
Notice the where @@ROWCOUNT > 0 clause. Take off your SET NOCOUNT ON statement and it should work.