Skip to content

HasMany interfaces  #49

@jagregory

Description

@jagregory

HasMany doesn't work well with collections of interfaces (especially when using Reveal)

public class Episode
{
  private IList<IContributor> contributors = new List<IContributor>();
}

public static OneToManyPart<T> ChildType<T>(this OneToManyPart<T> part, Type type)
{
  part.GetType()
    .GetField("valueType", BindingFlags.Instance | BindingFlags.NonPublic)
    .SetValue(part, type);
  part.GetType()
    .GetField("isTernary", BindingFlags.Instance | BindingFlags.NonPublic)
    .SetValue(part, true);

  return part;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions