Closed MikeCheel closed 6 years ago
I believe the issue is the class is missing the [Structure] attribute. This is what the formatter uses to determine how to serialize and de-serialize the request. There is a sample of how to use inheritance here : https://github.com/MohawkMEDIC/everest/blob/master/MARC.Everest.Test/Instances/CustomNamespaceTest.cs
Adding that attribute makes this exception go away but I get new exception "System.InvalidOperationException : Token StartAttribute in state Start would result in an invalid XML document. Make sure that the ConformanceLevel setting is set to ConformanceLevel.Fragment or ConformanceLevel.Auto if you want to write an XML fragment."
Any idea where ConformanceLevel is set? I'm just trying inherit from ClinicalDocument and add some additional properties / methods.
I figured it out!
private const string CustomNamespace = "urn:custom";
[Structure(Name = "ClinicalDocument", NamespaceUri = CustomNamespace, IsEntryPoint = true)]
class TestDocument : ClinicalDocument
{
}
If I create an empty class that inherits from ClinicalDocument, map some data into it and call this extension method on it I get an IndexOutOfRangeException:
If I do the same mapping to a direct instance of ClinicalDocument itself it works. Why does it throw the exception on classes that inherit from ClinicalDocument?
For example: