Relations Recompute
- Let's add a relation to our demo
public class DemoColumnsCollection : UIControllerBase
{
public readonly Models.Orders Orders = new Models.Orders();
public readonly Models.Customers Customers = new Models.Customers();
public DemoColumnsCollection()
{
From = Orders;
Relations.Add(Customers, Customers.CustomerID.IsEqualTo(Orders.CustomerID));
Columns.Add(Orders.OrderID);
Columns.Add(Orders.CustomerID);
Columns.Add(Orders.OrderDate);
}
public void Run()
{
Execute();
}
protected override void OnLoad()
{
View = () => new Views.DemoColumnsCollectionView(this);
}
}
Relations will only recompute based on columns that were added before the relation’s first column in the column collection
public class DemoColumnsCollection : UIControllerBase
{
public readonly Models.Orders Orders = new Models.Orders();
public readonly Models.Customers Customers = new Models.Customers();
public DemoColumnsCollection()
{
From = Orders;
Relations.Add(Customers, Customers.CustomerID.IsEqualTo(Orders.CustomerID));
Columns.Add(Orders.OrderID);
Columns.Add(Orders.CustomerID);
Columns.Add(Customers.CustomerID);
Columns.Add(Orders.OrderDate);
}
public void Run()
{
Execute();
}
protected override void OnLoad()
{
View = () => new Views.DemoColumnsCollectionView(this);
}
}
- Note that if the
Columns.Add
of theCustomers.CustomerID
column is after the call toColumns.Add
of theOrders.CustomerID
column, the relation toCustomers
will automatically recompute (refresh) whenever the value ofOrders.CustomerID
changes - Note that if the
Columns.Add
of theCustomers.CustomerID
column is Before the call toColumns.Add
of theOrders.CustomerID
column, the relation toCustomers
will NOT automatically recompute (refresh) whenever the value ofOrders.CustomerID
changes, it'll only evaluate once when you enter the row. - Note that you can also use the
__RecomputePath
property to explore the recompute of a relation. For more information see Columns Recompute
Help us improve, Edit this page on GitHub
or email us at info@fireflymigration.com