obtain host info if connection_factory used RRS feed

  • Question

  • We inherited a nicely made C# web application utilizing MVC and razor code. For applications, I do not like any differences between test and production including the web.config file. Usually I do not use a connection string defined in the web.config file, but instead manufacture that dynamically with a function with the host server name and other parameters establishing what database. In this case the application uses a connection factory. I don't want to make many changes, I see no way to easily reference the request object from where the connection string is fetched, and this only happens at one place in the application in a short init routine for connections. I have a couple of options. I can reference the machine name which would tell me whether test or production, but stuff often gets moved around and our servers are in clusters. Is there a way to reference the request object by possibly going through the running thread in the OS?
    Thursday, January 2, 2020 2:57 PM

All replies