Using AF Data Reference App.Config

Discussion created by AlistairFrith on Jan 22, 2014
Latest reply on Jan 25, 2014 by bperry

I have written a simple AF Custom Data Reference that uses a connection to a SQL Server database. I put the database connection string into the app.config for the DR. It now turns out that DLLs silently ignore their own app.config and Microsoft expects you to manually copy the settings into the hosts executable's app.config. There are various work-arounds on the Web that purport to allow the dll to find and open its app.config explicitely but they all seem to be a bit horrible (and not recommended)


So how am I supposed to do this in the context of an AF Data Reference? Can I access the dll's app.config? If not, which exe's app.config do I need to edit? If it's the client, then that is every copy of ProcessBook, Datalink (or is that really Excel?), PI System Explorer and several custom clients at the customer site. It's unworkable!


As a hack to get things working, I am retrieving the SQL connection string from  an attribute in the AF database and this seems to work ok. I suppose technically, it should be part of the Data Reference attribute's configuration string but I was trying to keep things really simple and just have a single connection string that the data reference always uses.


--- Alistair