Skip to content

Enforce strongly typed xp on extended resource classes #431

@ArchitectedDev

Description

@ArchitectedDev

Custom classes that extend a resource with a specified strongly-typed xp require the xp to be assigned in the constructor to enforce the strongly-typed xp. Currently no extended resource class adheres to this, allowing any xp to be used in code.

Prior to making the change to each class, we will need to validate that we don't introduce any data corruption to existing usages of the extended resource class or any instance of the base resource class.

The example provided in ordercloud-dotnet-sdk: Strongly Typed xp:

public class MyUser : User<MyUserXp> (
    public MyUser() {
        xp = new MyUserXp();
    }
)

public class MyUserXp
{
    public string Gender { get; set; }
}

var user = new MyUser();
user.xp.Gender = "male"; // strongly typed!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions