public object Execute(ISelectIdentity Query) { DbCommand command; DbDataReader reader; object result = null; command = commandBuilder.BuildCommand(Query); using (DbConnection connection = connectionFactory.CreateConnection()) { connection.Open(); command.Connection = connection; try { reader = command.ExecuteReader(); } catch (Exception ex) { throw new ORMException(command, ex); } using (reader) { if (!reader.Read()) { throw new ORMException(command, new Exception("No identity value returned")); } result = reader[0]; if (Query.ResultCallBack != null) { Query.ResultCallBack(result); } } } return(result); }