Just for the sake of testing, What if you do this:
using (var adapter = new DataAccessAdapter())
{
try
{
adapter.ConnectionString = _connectionString;
adapter.StartTransaction(IsolationLevel.ReadCommitted, "SaveEntity" + DateTime.Now.ToString("ddMMyyyyhhmmss"));
isSavedSuccessfully = entity.Fields.State == EntityState.Deleted
? adapter.DeleteEntity(entity)
: adapter.SaveEntity(entity, refetchAfterSave);
adapter.Commit();
}
catch
{
adapter.Rollback();
throw;
}
}
... or using your original code (TAdapter, witthout the first adapter.Commit) and with this change in your TAdapter:
public class EntityWriteManager<TEntity, TEntityCollection, TAdapter> : IEntityWriteManager<TEntity, TEntityCollection>
where TEntity : class, IEntity2, new()
where TEntityCollection : class, IEntityCollection2, new()
where TAdapter : IDataAccessAdapter, new()
{}
Why are you using that EntityWriteManager? and Why are you instantiating DataAccessAdapterBase? Maybe i don't understand your custom class.