Skip to content

Support type hierarchies across multiple files and projects. #70

Open
@jviau

Description

@jviau

Having type hierarchies across multiple files and projects will allow for extensible designs when the base class is in a consumed library. This would allow for something such as the following:

Project A

    [GenerateImmutable(GenerateBuilder = true)]
    public partial class NodeA
    {
        readonly string name;
        readonly ImmutableHashSet<string> tags;
    }

    [GenerateImmutable(GenerateBuilder = true, DefineRootedStruct = true)]
    public partial class Tree
    {
        readonly ImmutableSortedSet<Tree> children;
        readonly NodeA node;
    }

Project B

    [GenerateImmutable(GenerateBuilder = true)]
    public partial class NodeB : NodeA
    {
        readonly string mySpecializedProperty;
    }

This will not work with the current way <Immutable>.To<InheritedType>() works. Perhaps those methods should be moved to extension methods, but then CreateWithIdentity(...) would have to become public and always generated.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions