[CONNECT .NET] Get Configuration Variable Value

A customer asked: "My problem is having a class that will read a MicroStation config variable."  An extended version of this answer is available.

DgnPlatformNet

The answer is straightforward, once you've (a) asked the right question, and (b) found the appropriate help document.  Look in the DgnPlatformNet help doc. to find the ConfigurationManager class. All its methods are static.  Here's an example...

string CfgVarName = "MS_DEF"; // Example
string cfgVarValue = ConfigurationManager.GetValue (CfgVarName);

MstnPlatformNet

There's also the Workspace Interface, which you'll find in the MstnPlatformNet help doc. That's a wrapper around the VBA (COM) functionality, and is best avoided in favour of the ConfigurationManager class mentioned above.

Unhelpful Documentation

This is yet another example of confusion created by the .NET documentation, which is scattered over several .chm files. Depending where you start, you get a different answer. The MstnPlatformNet doc doesn't mention the ConfigurationManager, and the DgnPlatformNet doc doesn't mention the Workspace Interface.

  • I have two comments to this issue:

    When there are more options, in my opinion what is in DgnPlatformNet is typically better, because it's closer to "the core platform".

    But I agree the documentation in this form, which is what normally documentation was 15 years ago, is really confusing. So even when my C++ / NET split is 1:9, I simply don't use the documentation. It's time wasting and useless effort. With an exception of EC objects help, there is nothing that cannot be found in C++ documentation faster.

    My typical workflow is that I try to find the information in C++ help, after that searching set of typical assemblies (fulltext search in NET decompiler allows it in a seconds) whether this class is used and it leads to proper NET wrapper. From time to time, chm files can be just confirmation it's the correct finding.

    With regards,

      Jan