BindValue and BindEqualTo in the Migrated code

  • In Magic you couldn't set the default value property to a runtime determined value, and instead you would use an "Init" expression, which gets migrated to "BindValue"

Migrated code will usually use BindValue instead of DefaultValue

public void Run(Number OrderId)
{
-   Order_Details.OrderID.DefaultValue = OrderId;
    Order_Details.OrderID.BindValue(() => OrderId);
    Where.Add(Order_Details.OrderID.IsEqualTo(OrderId));
    Execute();
} 
  • Since this is a common pattern, used throughout the code, the migration engine automatically translates this to 'BindEqualTo' so instead of two lines, you now have one.
public void Run(Number OrderId)
{
-   Order_Details.OrderID.BindValue(() => OrderId);
-   Where.Add(Order_Details.OrderID.IsEqualTo(OrderId));
    Where.Add(Order_Details.OrderID.BindEqualTo(OrderId));
    Execute();
} 

Final Result

public void Run(Number OrderId)
{
    Where.Add(Order_Details.OrderID.BindEqualTo(OrderId));
    Execute();
} 

Help us improve, Edit this page on GitHub
or email us at info@fireflymigration.com