/// <summary> /// Envia uma mensagem para o debug. /// </summary> /// <param name="message">Mensagem a ser enviada.</param> protected void SendMessageDebugTrace(string message) { #if DEBUG //System.Diagnostics.Debug.WriteLine(message); #endif if (GDASettings.EnabledDebugTrace) { GDAOperations.CallDebugTrace(this, message); } }
/// <summary> /// Recupera as informações sobre a chave identidade da tabela. /// </summary> /// <param name="map"></param> protected void GetIdentityInformation(TableMap map) { if (map != null) { IDbConnection conn = ProviderConfiguration.CreateConnection(); GDAConnectionManager.NotifyConnectionCreated(conn); IDbCommand cmd = conn.CreateCommand(); cmd.Connection = conn; if (conn.State != ConnectionState.Open) { conn.Open(); GDAConnectionManager.NotifyConnectionOpened(conn); } try { foreach (FieldMap fm in map.Fields) { if (fm.IsPrimaryKey) { if (!map.IsView) { cmd.CommandText = String.Format("select COLUMNPROPERTY(OBJECT_ID('{0}'), '{1}', 'IsIdentity') as IsIdentity ", map.TableName, fm.ColumnName); using (IDataReader reader = cmd.ExecuteReader()) { if (reader.Read()) { fm.IsAutoGenerated = (reader["IsIdentity"].ToString() == "1"); } } } } } } catch (Exception ex) { GDAOperations.CallDebugTrace(this, String.Format("Unable to determine whether PK column of table {0} is an identity column.", map.TableName)); GDAOperations.CallDebugTrace(this, ex.Message); } finally { conn.Close(); conn.Dispose(); } } }