public int Execute() { SqlCommand command = connection.GetCommand(commandText); DatabaseTrace.Append(command.CommandText, Constant.Query); if (connection.HasTransaction) { command.Transaction = connection.Transaction; } return(command.ExecuteNonQuery()); }
public T[] ToArray <T>() { T[] callback; using (SqlCommand command = connection.GetCommand(commandText)) { DatabaseTrace.Append(command.CommandText, Constant.Query); if (connection.HasTransaction) { command.Transaction = connection.Transaction; } using (SqlDataReader reader = command.ExecuteReader(CommandBehavior.Default)) { callback = DatabaseReaderSelect <T> .ToArray(reader); reader.Close(); } } return(callback); }
public void Fill(EntitySet <TEntity> EntitySet) { if (EntitySet.Context.ContextType != typeof(TEntityContext)) { throw new EntityDatabaseException($"{this}, Write Failed, {EntitySet} Context Must Be Type Of {typeof(TEntityContext)}"); } using (SqlCommand command = connection.GetCommand(commandText)) { DatabaseTrace.Append(command.CommandText, Constant.Query); if (connection.HasTransaction) { command.Transaction = connection.Transaction; } using (SqlDataReader reader = command.ExecuteReader(CommandBehavior.Default)) { EntityDatabaseReaderSelect <TEntityContext, TEntity, TEntityCallBack> .Fill(reader, EntitySet); reader.Close(); } } }