Skip to content

Known types - LI element limited to multiple types with 1 item #160

Open
@Sevitas

Description

Motivation

Solves scenario 3 of issue #90 scenarios
Linked items element limited to multiple types with at least 1 at most or exactly 1 item.

Proposed solution

Article.Generated.cs will contain

public IEnumerable<IContentItem> Attachement { get; set; }

Article.Typed.Generated.cs will contain

public Image AttachementImageSingle => Attachement.OfType<Image>().FirstOrDefault();
public Other AttachementOtherSingle => Attachement.OfType<Other>().FirstOrDefault();

Additional context

As a developer, you still need to check which property contains a value. Other properties will contain a null.
Take in mind responses and notes in the comment.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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