Hello @Mohamed Hassan Anver,

I think that the tutorial is for EF 6 that is designed for .NET Framework. And MS is not promoting more EF Framework, right now, MS has EF core as goal (check this: https://docs.microsoft.com/es-es/ef/efcore-and-ef6/ ) and is the right EF to go in my opinion.

However IRIS is not supporting EF Core https://community.intersystems.com/post/how-can-i-use-iris-net-core-entity-framework. :-( 

Any thought @Bob Kuszewski ?
 

Well, there are only 2 tables related with that queries:

Ens.MessageHeader(https://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=EMONITOR_concepts#EMONITOR_concepts_msgs)

EnsLib.HL7.Messages (https://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=EHL72_tools#EHL72_tools_classes)

Any Ensemble Message has a header object or record (Ens.MessageHeader) the Message Body related with this Header can be any persistent object. Then you have to check MessageBodyClassName property to check if the body is a EnsLib.HL7.Message, then you can link the Header and Body using MessageBodyId property.

I hope this helps.

Ens.MessageHeader

Hello Lassi,

You should create a new Business Service class extending the HL7 Business Service of your election (TCP, HTTP, etc) and after overwrite this method:

method OnConstructReply(Output pReplyDoc As EnsLib.EDI.Document, pOriginalDoc As EnsLib.EDI.Document, ByRef pReplyCode As %String, ByRef pSC As %Status, pEarlyAck As %Boolean) as %Status

Override this method to construct a customized reply document. Inputs are the original document and the reply code and the status code that the framework produced in processing the original document. If you change the status code but do not construct a reply document, the framework will use the new value to construct a standard reply document. 
If you construct a non-HL7 object it must still have a property called 'Envelope'. Piece:2 of this value will be written verbatim.

Consider this example (I didn't test it):

method OnConstructReply(Output pReplyDoc As EnsLib.EDI.Document, pOriginalDoc As EnsLib.EDI.Document, ByRef pReplyCode As %String, ByRef pSC As %Status, pEarlyAck As %Boolean) as %Status

{

    Set pReplyDoc=pOriginalDoc.NewReplyDocument(,..LocalFacilityApplication)
    Set pReplyDoc.Source=pOriginalDoc.%Id()
    Do:..#UseOriginalControlId pReplyDoc.SetValueAt(pOriginalDoc.GetValueAt("1:10"),"1:10") ; copy the control id to the ack control id
    Set tAckMSA=##class(EnsLib.HL7.Segment).%New($LB("",1))
    Set tAckMSA.Separators=pReplyDoc.Separators
    Do tAckMSA.SetValueAt("MSA",0)
    Do tAckMSA.SetValueAt("CE",1)
    Do tAckMSA.SetValueAt(pOriginalDoc.GetValueAt("1:10"),2)
    Do:$G($$$ExpectedSequenceNumber) tAckMSA.SetValueAt($$$ExpectedSequenceNumber,4)
    Do pReplyDoc.AppendSegment(tAckMSA)
    Set pReplyDoc.IsMutable=0
    Quit $$$OK

}

The installation should be done using root or sudoing. Moreover in order to use a specific user/group to owner the instance, I normally create first the user and add it to Wheel, Admin and any group you want, and after:

[root@xxx]# ./cinstall


Your system type is 'Red Hat Enterprise Linux 6 (x64)'.


Enter instance name <ENSEMBLE>: 

Enter a destination directory for the new instance.

Directory: /engine/ensemble

Directory '/engine/ensemble' does not exist.

Do you want to create it <Yes>? 


Select installation type.

    1) Development - Install Ensemble server and all language bindings

    2) Server only - Install Ensemble server

    3) Custom

Setup type <1>? 3


Disk blocks required  = 2792344

Disk blocks available = 15482688


How restrictive do you want the initial Security settings to be?

"Minimal" is the least restrictive, "Locked Down" is the most secure.

    1) Minimal

    2) Normal

    3) Locked Down

Initial Security settings <1>? 2


What user should be the owner of this instance? ensemble

A Cache account will also be created for user ensemble.


Install will create the following Ensemble accounts for you: 

_SYSTEM, Admin, SuperUser, CSPSystem and ensemble. 

Please enter the common password for these accounts: ensemble

Re-enter the password to confirm it: ensemble


What group should be allowed to start and stop

  this instance? ensemble


Do you want to configure additional security options <No>? y


What is the effective group for Ensemble processes <cacheusr>? ensemble


What is the effective user for the Cache SuperServer

  and its jobs <cacheusr>? ensemble


Hope helps

Hello,

The common approach is set the schema category in the Business Service. If you want to capture everything at BS, this is the right approach if you are using only one HL7 Schema (2.5 for example). But if you use several HL7 Schemas then is better to get them separate in order to use different BS (each one with their own schema).

In any case you can use a main entry point (BS) don't set the HL7 category at BS and set it "manually" at Business Process stage. This approach is not the most elegant because all the messages arrives at BP (with map errors, and without the DocType set). Then search or process them is more complicated.

Hope this help