Version 7, last updated by markcopenhaver at December 15, 2010 03:47 UTC
XMLDocument
Here are the steps to create a Document Component. You can get the source code here: XMLDocumentExample
Step 1 – Create the assembly
Start Visual Studio 2008 or 2010
New Project – C# Class Library
Add reference to EncounterPRO.OS.Component
Change/replace class to inherit from EncounterPRO.OS.Component.Document
Add stubs for these override methods. For example:
namespace XMLDocumentExample
{
public class XMLDocumentExample : EncounterPRO.OS.Component.Document
{
protected override string createDocument(string InputXML)
{
return null;
}
protected override string getDocumentElements(string InputXML)
{
return null;
}
protected override string configureDocument(string InputXML)
{
return null;
}
}
}
Add desired code to createDocument ()
If desired, set the AssemblyVersion in AssemblyInfo.cs (usually in the “Properties” folder)
Sign assembly
- Right click on project, select Properties
- Click on “Signing” tab
- Check the “Sign the assembly” checkbox
- If you already have a key file then you probably don’t need these instructions. Otherwise, select “New” from the dropdown. On the popup, give your key file a name and a password.
Build the assembly
First, make sure the Target Assembly (on the project property-Application tab) is set to 3.5.1 I've done this exercise successfully with Visual Studio 2008, Visual Studio 2010, and Visual Studio 2010 Express. Both versions of 2010 work but they default to framework 4.0 so you need to go change it. If you download the XMLDocumentExample sample project, you'll find that VS2010 will preserve my project setting of framework 3.5, but VS2010 Express will flip it to 4.0 and the assemblies won't go into the GAC until you set it back to 3.5 and rebuild.
For Step 3, you’re going to need the class name of your component. Get that by looking at the “namespace” above your class definition and concatenate it, with a period between, with the class you created descending from the EncounterPRO.OS.Component.Service. In my example this turns out to be “XMLDocumentExample.XMLDocumentExample”.
1 I've tried setting the target framework to 4.0, but I haven't been able to put the resulting assembly into the GAC. It'll probably work if we rebuild the base class with the 4.0 framework too, but I haven't tried that yet.
Step 2 – Create the Installer
Follow these instructions to create the installer using the Generic NSIS Component Installer:
NSIS_Generic_Component_Installer
The only subfolder you need for the example service is GAC. Put both the service assembly from step 1 and the EncounterPRO.OS.Component.dll into the GAC subdirectory and follow the rest of the instructions.
Step 3 – Load the component into EncounterPRO-OS
Create a new component definition and component version by following the instructions here:
http://www.assembla.com/wiki/show/EncounterPRO-OS/Creating_a_Component_Version
Step 4a – Create a new Datafile Configuration Object
In EncounterPRO-OS, click on the Configuration tab and navigate to Interfaces. Double or right-click on “Datafiles”.
On the Select Datafile window, click the “Create New” button and answer the questions:
Enter title of new datafile. This will be the name that is used to refer to this datafile from all other config objects.
Select datafile context. If your datafile does not deal with an individual patient then select “General”. In my example there is no need for my datafile to know the patient context, so I selected “General”.
Select datafile component. Select your datafile component from the popup list.
At this point the new datafile has been created and the Datafile Configuration screen should be displayed. This is where component attributes can be set and/or datafile attributes can be defined. For now just click “Finished”.
Step 4b – Add a reference to the new datafile to a config object that you can activate