internal void RaiseAfeterAlterTable(TableAdapter tableAdapterForAlter) { if (OnAfterAlterTable != null) { OnAfterAlterTable(tableAdapterForAlter, new TableAdapterEventArgs()); } }
/// <summary> /// Altera uma tabela /// </summary> /// <param name="pTable">Tabela</param> /// <param name="pFields">Campos as ser aterado</param> public void AlterTable(TableAdapter pTable, IEnumerable <TableAdapterField> pFields) { var script = new SqlServerScriptWizard(); var table = new TableAdapter(pTable.DBName, pTable.TableName); table.Collumns.AddRange(pFields.ToList()); Connection.Instance.SqlServerExecute(script.GetAlterTableCommand(table)); pTable.RaiseAfeterAlterTable(table); }
/// <summary> /// Instancia um objeto e atribui um alias para uma pesquisa mais complexa. /// </summary> /// <param name="pTableAdapter">Um TableAdpter</param> /// <param name="pWithFields">Chaves como clásula where</param> /// <param name="pAlias">Alias da tabela</param> public TableQuery(TableAdapter pTableAdapter, bool pWithFields, string pAlias) : this(pTableAdapter, false) { if (!pWithFields) { Fields = new TableAdapterFieldCollection(); } foreach (var item in pTableAdapter.Collumns) { item.TableAlias = pAlias; } Alias = pAlias; }
/// <summary> /// Instancia um objeto e atribui as chaves como compos de condição /// </summary> /// <param name="pTableAdapter">Um table adapter</param> /// <param name="pKeysAsWhere"></param> public TableQuery(TableAdapter pTableAdapter, bool pKeysAsWhere = false) : this() { Fields.AddRange(pTableAdapter.Collumns); DbName = pTableAdapter.DBName; TableName = pTableAdapter.TableName; SchemaTable = pTableAdapter.SchemaTable; WithoutNotLock = pTableAdapter.WithoutNotLock; if (!pKeysAsWhere) { return; } foreach (var myItem in pTableAdapter.KeyFields) { Where.Add(new QueryParam(myItem)); } }
public Navigation(TableAdapter pTableAdapter) { _tableObj = pTableAdapter; }