UIControllerColumns Property
Namespace: Firefly.BoxAssembly: Firefly.Box (in Firefly.Box.dll) Version: debug-master-v:33791
public ColumnCollection Columns { get; }
Public ReadOnly Property Columns As ColumnCollection
Get
abstract Columns : ColumnCollection with get
override Columns : ColumnCollection with get
ColumnCollectionITaskColumns Columns that are associated with this
UIController will be part of it's reevaluation mechanism
Any column that is associated with an entity that is added to this list, will be fetched from the database.
If no columns were added the
AddAllColumns method will be called automatically
The reevaluation engine, causes automatic reevaluation of expressions and relations that are based on
columns that were added to this collection.
Any column that is part of this
Columns property collection, will be part of the reevaluation engine.
The reevaluation is performed when a row is entered, or a value of a column is changed.
The reevaluation engine affects the following items:
Relation reevaluation behavior - The first column that is associated to a
Entity that was added using the
Relations property, will determine that
Relation's reevaluation.
The reevaluation basic behavior
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.
using System;
using System.Collections.Generic;
using System.Text;
using Firefly.Box.Data;
using NUnit.Framework;
using Firefly.Box;
using Firefly.Box.Testing;
namespace TestFirefly.Box.Documentation
{
[TestFixture]
public class ColumnsCollection
{
[Test]
public void BasicReevaluation()
{
var bp = new BusinessProcess();
NumberColumn a = new NumberColumn(),
b = new NumberColumn();
bp.Columns.Add(a, b);
b.BindValue(() => a + 5);
bp.ForFirstRow(() =>
{
a.ShouldBe(0);
b.ShouldBe(5);
a.Value = 6;
a.ShouldBe(6);
b.ShouldBe(11);
});
}
[Test]
public void ReevaluationIsNotDoneBeforeAnyRowWasEntered()
{
var bp = new BusinessProcess();
NumberColumn a = new NumberColumn(),
b = new NumberColumn();
bp.Columns.Add(a, b);
b.BindValue(() => a + 5);
bp.Start += () =>
{
a.ShouldBe(0);
b.ShouldBe(0); //Because a row was not entered, and no value was set,
//the reevaluation of b was not performed
};
bp.ForFirstRow(() =>
{
a.ShouldBe(0);
b.ShouldBe(5);
a.Value = 6;
a.ShouldBe(6);
b.ShouldBe(11);
});
}
}
}