Currently, the Firely POCO's use a string for Extension.url, where a FhirString is expected. There is no way the TypeConverter can currently "hide" this fact for the ExpressionBuilder, so we had to make a patch in the Expression builder specifically for the Firely model. This is of course not optimal, so we should find a way for the model to handle this.
One way is for GetProperty to return a Linq.Expression instead of a PropertyInfo, as this gives the underlying converter way more freedom to insert masking code so the Builder does not have to know about intricacies of the underlying model. We tried this in the past but failed, but it might be worth a second try.
For now, this patch is done to the TypeFor() method. This method normally takes the CQL model types expected from the resultTypeSpecifier, but if a Property expression does not have a resultTypespecifier (which it does in the case of most Extension.url accesses), it relies on the underlying model. Which returns the "incorrect" type of string, (where the CQL model would have had FHIR.String). The TypeFor() method now corrects for this.
Currently, the Firely POCO's use a
string
for Extension.url, where aFhirString
is expected. There is no way the TypeConverter can currently "hide" this fact for the ExpressionBuilder, so we had to make a patch in the Expression builder specifically for the Firely model. This is of course not optimal, so we should find a way for the model to handle this.One way is for GetProperty to return a Linq.Expression instead of a PropertyInfo, as this gives the underlying converter way more freedom to insert masking code so the Builder does not have to know about intricacies of the underlying model. We tried this in the past but failed, but it might be worth a second try.
For now, this patch is done to the
TypeFor()
method. This method normally takes the CQL model types expected from theresultTypeSpecifier
, but if a Property expression does not have a resultTypespecifier (which it does in the case of most Extension.url accesses), it relies on the underlying model. Which returns the "incorrect" type of string, (where the CQL model would have had FHIR.String). The TypeFor() method now corrects for this.