[This is preliminary documentation and is subject to change.]

Used for quick, read-only pass over all the rows of the BusinessProcess.

Namespace:  Firefly.Box
Assembly:  Firefly.Box (in Firefly.Box.dll) Version: 3.4.23.6473 (3.4.23.6473)

Syntax

C#
public void ReadAllRows(
	Action runForEachRow
)
Visual Basic (Declaration)
Public Sub ReadAllRows ( _
	runForEachRow As Action _
)
Visual C++
public:
void ReadAllRows(
	Action^ runForEachRow
)

Parameters

runForEachRow
Type: System..::.Action

Remarks

This method purpose is to create a quick and "cheap" read of all the rows of the BusinessProcess.
This Method can be performed only from Start event, End event, EnterRow event, LeaveRow event and SavingRow event.

Examples

using the read all rows to display each row's precentage of the total value
This example is in the form of Unit Tests. It references the NUnit framework. This framework can be downloaded from www.NUnit.org. For more information about unit testing visit: www.NUnit.org.
This example is based on test data. The code for the entities included in this test data can be found in the documentation of Entity
CopyC#
using System;
using System.Collections.Generic;
using System.Text;
using NUnit.Framework;
using Firefly.Box;
using Firefly.Box.Testing;

namespace TestFirefly.Box.Documentation
{
    [TestFixture]
    public class ReadAllRows
    {
        [Test]
        public void ReadAllRows1()
        {
            var jobs = new Pubs.Jobs();
            jobs.InitializeWithTestData();
            var bp = new BusinessProcess
                         {
                             From = jobs
                         };
            bp.Where.Add(jobs.MinLevel.IsGreaterOrEqualTo(50));
            var total = 0;
            var result = "";

            bp.ForEachRow(()=>
                              {
                                  if(total == 0)
                                      bp.ReadAllRows(() => total += jobs.MinLevel);
                                  result += jobs.Id.ToString().Trim() + " " + (jobs.MinLevel/total*100).ToString("3%").Trim();
                              });
            result.ShouldBe("9 6%"  +
                            "10 6%" +
                            "11 6%" +
                            "8 8%"  +
                            "7 9%"  +
                            "6 11%" +
                            "5 12%" +
                            "3 14%" +
                            "4 14%" +
                            "2 16%");
        }
    }
}

See Also