protected Fill ( |
||
dataTables | ||
startRecord | int | |
maxRecords | int | |
command | IDbCommand | |
behavior | CommandBehavior | |
return | int |
protected virtual int Fill(DataTable[] dataTables, int startRecord, int maxRecords, IDbCommand command, CommandBehavior behavior)
{
long logScopeId = DataCommonEventSource.Log.EnterScope("<comm.DbDataAdapter.Fill|API> {0}, dataTables[], startRecord, maxRecords, command, behavior={1}", ObjectID, behavior);
try
{
if ((null == dataTables) || (0 == dataTables.Length) || (null == dataTables[0]))
{
throw ADP.FillRequires("dataTable");
}
if (startRecord < 0)
{
throw ADP.InvalidStartRecord(nameof(startRecord), startRecord);
}
if (maxRecords < 0)
{
throw ADP.InvalidMaxRecords(nameof(maxRecords), maxRecords);
}
if ((1 < dataTables.Length) && ((0 != startRecord) || (0 != maxRecords)))
{
throw ADP.OnlyOneTableForStartRecordOrMaxRecords();
}
if (null == command)
{
throw ADP.MissingSelectCommand(ADP.Fill);
}
if (1 == dataTables.Length)
{
behavior |= CommandBehavior.SingleResult;
}
return FillInternal(null, dataTables, startRecord, maxRecords, null, command, behavior);
}
finally
{
DataCommonEventSource.Log.ExitScope(logScopeId);
}
}
DbDataAdapter::Fill ( |
|
DbDataAdapter::Fill ( |
|
DbDataAdapter::Fill ( |
|
DbDataAdapter::Fill ( |
|
DbDataAdapter::Fill ( |
|
DbDataAdapter::Fill ( |
|
DbDataAdapter::Fill ( int startRecord, int maxRecords ) : int |
/// <summary> /// Retrieves a list of objects. /// </summary> /// <param name="transaction">The transaction to execute the command in.</param> /// <param name="result">When this method returns, a list of entity objects created /// by the SelectCommand. This parameter is passed uninitialized..</param> /// <returns></returns> public virtual void Get(Transaction transaction, out List <T> result) { result = new List <T>(); if (SelectCommand == null) { DataTable table = CreateDataTable(); InitializeDataAdapter(transaction); _dataAdapter.Fill(table); foreach (DataRow row in table.Rows) { result.Add(CreateEntityFromDataRow(row)); } } else { DataSet set; if (transaction == null) { set = _query.Execute(SelectCommand); } else { set = _query.Execute(transaction, SelectCommand); } foreach (DataRow row in set.Tables[0].Rows) { result.Add(CreateEntityFromDataRow(row)); } } }