Professional OPC
Development Tools

logos

Online Forums

Technical support is provided through Support Forums below. Anybody can view them; you need to Register/Login to our site (see links in upper right corner) in order to Post questions. You do not have to be a licensed user of our product.

Please read Rules for forum posts before reporting your issue or asking a question. OPC Labs team is actively monitoring the forums, and replies as soon as possible. Various technical information can also be found in our Knowledge Base. For your convenience, we have also assembled a Frequently Asked Questions page.

Do not use the Contact page for technical issues.

Best Practices - Instance vs Singleton

More
30 May 2019 14:18 #7421 by support
Hello.

QuickOPC objects whose type names end with Parameters or Descriptor are always light-weight objects that do not consume anything above a piece of managed memory. You are free to create and recreate them as needed, without unreasonable "cost".

EasyDAClient objects are somewhat different. When you have multiple instances of EasyDAClient, they are designed so that internally they share many data, and connections to the target servers. But still, each instance requires things like separate threads for event notifications etc., and also is relatively heavy in terms of set-up and tear-down.

Of the two methods you proposed, I suggest to use
" a parent method that each time calls an existing instance EasyDAClient (eventually a singleton) with its own EasyDAInstanceParameters and ServerDescriptor".

The connections are closed automatically, in the background, after a configurable period of inactivity. You do not have to do anything in your code for it to happen. Although calling Dispose is "contractually" required on anything that implements IDisposable (and, therefore, on EasyDAClient as well), in our implementation we do not require you to call it.

Best regards

Please Log in or Create an account to join the conversation.

More
29 May 2019 08:14 #7418 by davide
Good morning,
I would know what is the best way to get ​​values ​​using ReadMultipleItems:
- a parent method that each time recreate an EasyDAClient with its own EasyDAInstanceParameters and ServerDescriptor
- a parent method that each time calls an existing instance EasyDAClient (eventually a singleton) with its own EasyDAInstanceParameters and ServerDescriptor
Finally, in both cases, it is sufficient use dispose() to free resource and close correctly the connections? Otherwise how is it possible?
Thanks in advance,
Davide

Please Log in or Create an account to join the conversation.

Moderators: support
Time to create page: 0.041 seconds