Skip to content

Strongly typed XP doesn't work on Partial models #156

@crhistianramirez

Description

@crhistianramirez

When using strongly typed XP with full models, everything works as expected. However, on partial models, XP is returned as dynamic, breaking type safety.

Example

public class UserXp {
    public bool HasLoggedIn { get; set; }
}

var user = new User<UserXp> { };
var userLoggedIn = user.xp.HasLoggedIn; // Strongly typed!

var partialUser = new PartialUser<UserXp> { };
var pUserLoggedIn = partialUser.xp.HasLoggedIn; // This is not strongly typed! xp comes back as dynamic

This may be tricky to support because for partials we want to send OrderCloud only the values that have changed. To do that, we need to distinguish between a property with a null/default value and a completely absent property. In any case, we should either figure out how to support this OR simply not generate types that make it look like it's supported.

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