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

Sets an expression that determines if the current row will be deleted once left.

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

Syntax

C#
public void DeleteRowAfterLeavingItIf(
	Func<bool> condition
)
Visual Basic (Declaration)
Public Sub DeleteRowAfterLeavingItIf ( _
	condition As Func(Of Boolean) _
)
Visual C++
public:
void DeleteRowAfterLeavingItIf(
	Func<bool>^ condition
)

Parameters

condition
Type: System..::.Func<(Of <(Boolean>)>)

Remarks

Notice that when the expression evaluates to true, the LeaveRow event will execute a second time (the first one was when the row was left), this time with Delete Activity property

Examples

This example demonstrates the usage of DeleteRowAfterLeavingIt
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 DeleteRowAfterLeavingIt
    {
        [Test]
        public void Demo()
        {
            var employees = new Pubs.Employees();
            employees.InitializeWithTestData();// Insert test data to the table
            employees.CountRows().ShouldBe(43);// Verifies that the test data has 43 rows

            var bp = new BusinessProcess
                         {
                             From = employees
                         };
            bp.DeleteRowAfterLeavingItIf(() => employees.MiddleInitial == "");// Settings the Delete row condition


            int numberOfLeaveRowInUpdateActivity = 0;
            int numberOfLeaveRowInDeleteActivity = 0;
            int numberOfLeaveRowExecutions = 0;
            bp.LeaveRow += ()=>
                               {
                                   if (bp.Activity == Activities.Update)//Counting executions for update activity
                                   {
                                       numberOfLeaveRowInUpdateActivity++;
                                   }
                                   if (bp.Activity == Activities.Delete)//Counting executions for Delete activity
                                   {
                                       numberOfLeaveRowInDeleteActivity++;
                                   }
                                   numberOfLeaveRowExecutions++;
                               };
            bp.Run();
            numberOfLeaveRowInUpdateActivity.ShouldBe(43);//The leave row was executed once for each employee in update mode
            numberOfLeaveRowInDeleteActivity.ShouldBe(10);//The leave row was executed again for the 10 employees that matches the condition
            numberOfLeaveRowExecutions.ShouldBe(53);//The leave row was executed a total of 53 times.
        }
    }
}

See Also