FirelyTeam / firely-net-sdk

The official Firely .NET SDK for HL7 FHIR
Other
829 stars 345 forks source link

Add the notion of "Parent" to pocos #2895

Closed ewoutkramer closed 1 month ago

ewoutkramer commented 1 month ago

Or whatever is necessary to implement the new interface #2894.

ewoutkramer commented 1 month ago

We used this scratch code during our discussions:

interface IScopedNode
{
    string Name;

    IEnumerable<object> Children()
}

class Base : IScopedNode
{
    virtual IScopedNode.Children()
    {
        foreach(child c in ....)
        {
            c._parent = this;
            yield c;
        }
    }

    IScopedNode AsRootNode()

        this._parent = null;
        return (IScopedNode)this;
    } 

}

var p = new Patient() { .... };
var isn = p.AsScopedNode();
var namex = isn.Select("resolve()").First();
ewoutkramer commented 1 month ago

This is part of #2910, and I consider this design done.