Closed sandeepac closed 7 years ago
More Info: Department resource is a custom resource. Inherited from domain resource.
Hi @sandeepac, the only way to handle custom resources currently is to create a StructureDefinition for it, add it to the profiles-resources.xml file in the Model/Generated/Source directory, and rerun the T4 templates - you'll get your own version of the .NET library, with a POCO for your own resources....
Thanks @ewoutkramer , We will try the solution.
Hi @ewoutkramer, I have tried to rerun the Template-Model.tt by right click-> Run custom tool. I am getting the error(as attached). This is with the original profiles-resources.xml file. Is there any sequence in which the T4 templates need to be re-run or Is there any tool that we can use the run the T4 templates. I have opened the solution in VS 2017 and .Net framework is 4.5.
Hi @sandeepac, you're doing the same thing I am doing & using the same tools ;-) What branch are you using?
This may help too: Make sure you never accidentally run the TemplateFileManagerV2.1.ttinclude file separately. If so, just remove the associated .cs file and try again.
There was a newline character at the end of TemplateFileManagerV2.1.ttinclude file, removed that. It is working now. Thanks.
Yes, I think adding this to .csproj will avoid some of this trouble:
<None Update="Model\Generated\TemplateFileManagerV2.1.ttinclude">
<Generator>TextTemplatingFileGenerator</Generator>
<LastGenOutput>TemplateFileManagerV2.1.cs</LastGenOutput>
</None>
since this stuff is literally included in the other .tt files, it should never be compiled all by itself.
Hi to everyone; I have a problem in deserializing a custom class containing some fhir object in it.
For example a CustomClass extending the DomainResource and containing as class variable a Patient instance and other variables (booleans, string...).
Does exist a way to register a custom resource type in C# using the FHIR C# library (without modifying the profiles-resources.xml file) and to deserialize it in a Controller? In other words I'd like to deserialize in the C# controller a class instance containing the following information:
{
"resourceType":"customClass",
"id":"0c5b363e-ec06-4908-9727-3ddfccb209d1",
"meta":{
"profile":[
"http://hl7.org/fhir/profiles/custom-class"
]
},
"boolExample":true,
"patient":{
"resourceType":"Patient",
"id":"af8b5324-0d88-11e8-a996-000c296d924a",
"gender":"female",
"birthDate":"2018-04-03"
}
}
The controller signature should be something like this:
[HttpPost("asignature")]
public void ReceiveCustomClass([FromBody]CustomClass customClass)
{
//Handle customClass object
}
Thanks in advance. Matteo
How to access the Custom Resource using the .net client?