public static void UpdateEntity <T>(T entity) where T : class, IRepositoryEntity, IRepositoryUpdatedEntity, new() { var entityDbName = entity.GetTableName(); var idFieldName = entity.GetIdFieldName(); var fields = entity.GetFieldNames(); var id = entity.GetId(); var source = new IMRecordset(entityDbName, IMRecordset.Mode.ReadWrite); source.Select(fields); source.SetWhere(idFieldName, IMRecordset.Operation.Eq, id.ToString()); using (source.OpenWithScope()) { if (source.IsEOF()) { throw new InvalidOperationException($"Not found a record of {entityDbName} by Id #{id}"); } source.Edit(); entity.SaveToRecordset(source); source.Update(); } }