Refactoring the Relation to the Type Class
Using the getv
snippet, we can add the GetName
method to the CustomerID
type and remove all the relations in my code that were used to get the CompanyName
public class CustomerID : TextColumn
{
public CustomerID() : base("Customer ID", "5")
{
Expand += () => new ShowCustomers().Run(this);
}
Models.Customers _lookupEntity;
public Text GetName()
{
if (_lookupEntity == null)
_lookupEntity = new Models.Customers();
return _lookupEntity.GetValue(_lookupEntity.CompanyName, _lookupEntity.CustomerID.IsEqualTo(this));
}
}
See Also: Types, I want more out of it !
Help us improve, Edit this page on GitHub
or email us at info@fireflymigration.com