/// <summary> /// Execute a ADO.NET operation on a command object using an Object Callback. /// </summary> /// <remarks>This allows for implementing arbitrary data access operations /// on a single command within Spring's managed DB4o environment.</remarks> /// <param name="callback">The delegate called with a command object.</param> /// <returns>A result object returned by the action or null</returns> public Object Execute(IDb4oCallback callback) { logger.Debug("Execute Callback"); // get a possibly existing connection ObjectContainer container = Db4oUtils.GetConnection(DataSource); object result; try{ logger.Debug("DoInDb4o"); result = callback.DoInDb4o(container); } catch (Exception e) { logger.Error("Exception while executing in Db4o", e); throw ConvertDb4oAccessException(e); } // dispose from the connection Db4oUtils.DisposeConnection(container, DataSource); return(result); }