You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To minimise null value bloat stored in xp of OrderCloud resources, we can update the strongly-typed xp classes to inherit from the OrderCloudModel and IPartial, which will remove unassigned properties during serialisation.
Inherit OrderCloudModel and IPartial
All properties getters and setters will also need to be reworked to utilise the Props dictionary.
The readme will need to be updated to reflect this as a standard practice.
Converting xp classes into partial xp classes will not allow default values to be set as this can unintentially override existing xp values during PATCH requests.
There is a dependency on updating the OrderCloud .NET SDK to support partial class deserialisation, before we can update xp classes to partials.
See the following example
// Before refactor
public class MyProductXp
{
public string Note { get; set; }
public string ProductType { get; set; }
public bool IsNew { get; set; }
public decimal Rating { get; set; }
}
// After refactor
public class MyProductXp : OrderCloudModel, IPartial
{
public string Note { get => GetProp<string>("Note"); set => SetProp<string>("Note", value); }
public string ProductType { get => GetProp<string>("ProductType"); set => SetProp<string>("ProductType", value); }
public bool IsNew { get => GetProp<bool>("IsNew"); set => SetProp<bool>("IsNew", value); }
public decimal Rating { get => GetProp<decimal>("Rating"); set => SetProp<decimal>("Rating", value); }
}
The text was updated successfully, but these errors were encountered:
To minimise null value bloat stored in xp of OrderCloud resources, we can update the strongly-typed xp classes to inherit from the OrderCloudModel and IPartial, which will remove unassigned properties during serialisation.
See the following example
The text was updated successfully, but these errors were encountered: