public ChangeLogForm(TableAdapter pTableAdapter) { if (!pTableAdapter.AutoLog) { throw new Exception(string.Format("Entidade {0} não controla log", pTableAdapter.TableName)); } _tableAdapter = new TableAdapterLog(pTableAdapter); InitializeComponent(); InitilizeForm(); SetEvents(); }
/// <summary> /// Hablita Log automático no tableAdapter /// </summary> public void SetAutoLog(bool autoLog = true) { if (autoLog) { TableAdapterLog = new TableAdapterLog(this); this.AutoLog = autoLog; } else if (TableAdapterLog != null) { TableAdapterLog.Detach(); TableAdapterLog = null; } }