Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace PocoBuilder to support overflow #2953

Open
wants to merge 16 commits into
base: develop-6.0
Choose a base branch
from

Conversation

ewoutkramer
Copy link
Member

@ewoutkramer ewoutkramer commented Oct 25, 2024

Wrote a replacement for PocoBuilder (for now, called PocoBuilderNew, they are internal classes anyway) that implements the new overflow and uses the Dynamic datatype classes for unknown types.

  • I have also replaced the ToPoco() extension methods to use the new builder
  • I have patched the old builder to eventually call the new builder.
  • Consequently I was able to throw away all the old ComplexTypeReader stuff.

Fixes #2947 .

Breaking changes

  • The DefaultModelFactory has been removed. It had not been in use for years, except by our own tests. With the cleanup of the PocoBuilder (ITypedElement->POCO) infrastructure, we decided to remove this class.

@Kasdejong Kasdejong marked this pull request as ready for review November 13, 2024 14:48
using ET = Hl7.Fhir.ElementModel.Types;
using ElementMappingInfo = (Hl7.Fhir.Introspection.ClassMapping Class, Hl7.Fhir.Introspection.PropertyMapping? Property);

namespace Hl7.Fhir.Serialization;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possibly better suited for Elementmodel namespace

// otherwise it's a DynamicDataType.
// Design question: there might be a "strict" option, where we will not create Dynamic types
// for unknown types, but throw an error instead.
if(node.Value is not null)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check if instancetype starts with a lowercase letter, since even a primitive could have only extensions

[Serializable]
[DataContract]
[FhirType("DynamicDataType","http://fire.ly/fhir/StructureDefinition/DynamicDataType")]
public class DynamicDataType : DataType, IDynamicType
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's consider making another part of base, and keeping the Base.cs file as close to the core model as possible


var poco = toPoco(subject);

poco.Active.Should().Be(true);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe try this with IsExactlyEqualTo?

Base automatically changed from 6.0/parse-elements-for-xml-parsers to develop-6.0 November 13, 2024 14:54
@ewoutkramer ewoutkramer changed the title First draft of a ITypedElement->POCO solution Replace PocoBuilder to support overflow Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants