Table of Contents

Class BatchCommitArgs

Namespace
Tripous.Data
Assembly
Tripous.Data.dll

Used with the TableSet CommitBatch() method.

public class BatchCommitArgs : EventArgs
Inheritance
BatchCommitArgs
Inherited Members
Extension Methods

Constructors

BatchCommitArgs(Func<bool>, Func<object, bool>, int)

Constructor

BeforeFunc: Provided by caller. It is called before each iteration.

AfterFunc: Provided by caller. It is called after each iteration. The whole batch operation terminates when AfterFunc() returns false

TransLimit: The transaction is commited each time the TransLimit is reached

public BatchCommitArgs(Func<bool> BeforeFunc = null, Func<object, bool> AfterFunc = null, int TransLimit = 300)

Parameters

BeforeFunc Func<bool>
AfterFunc Func<object, bool>
TransLimit int

Properties

AfterFunc

Optional. Provided by caller. It is called after each (post or no-post) and any iteration in the loop.

The TableSet passes the LastCommitedId to this method.

The whole batch operation terminates when this call returns false.

NOTE: If it is not provided, it is considered as returning true always.

public Func<object, bool> AfterFunc { get; }

Property Value

Func<object, bool>

BeforeFunc

Optional. Provided by caller. It is called before each and any iteration in the loop.

If it returns true, then the TableSet/Broker posts the row and increases the PostCounter counter.

The caller should return true, only when calls Broker.Insert() or Broker.Edit() (NO Broker.Delete()) from inside this method. Returning true is the sign that a row post is required.

NOTE: If it is not provided, it is considered as returning true always.

public Func<bool> BeforeFunc { get; }

Property Value

Func<bool>

Counter

The loop main counter. Just counts the iterations and increases in each iteration.

An iteration may end up in posting a row, or NOT.

For an iteration to post, the BeforeFunc() must return true.

public int Counter { get; set; }

Property Value

int

PostCounter

It increases when an iteration posts a row. The BeforeFunc() should return true, for this to happen.

This is NOT the commit counter. It is the counter for the posts to the database and is used, along with the TransLimit, to decide if the Transaction.Commit() should be called.

It is set by the TableSet, NOT the caller.

public int PostCounter { get; set; }

Property Value

int

Tag

User defined value.

public object Tag { get; set; }

Property Value

object

TransLimit

The transaction is commited each time the TransLimit is reached

public int TransLimit { get; }

Property Value

int