On Configurations and Factories

Oct 15, 2015 at 9:02 AM
Hi

In my applications, multiple independent Tasks may need access to the same ldap server. So I'm wondering how that's to be solved in the most efficient way without running afoul of problems. E.g. this morning I got an exception with
Static storage has already been set

The documentation on LdapConfiguration says, the configuration should only be done once, but you can have more than one configuration at a time. But.. in order to have a configuration, I need to instantiate and configure, wouldn't I? Or does new LdapConfiguration() get me a configuration that already has the settings of whatever was previously configured on another object?

Now imagine the program is running along and somebody decides that the credentials need to change. If I keep an instance of my LdapConfiguration around and call config.ConfigureFactory(serverName).AuthenticateAs(mycredentials).AuthenticateBy(..)

Or is there a way to change the credentials without creating a new config? There are now accesible properties, so the only way I found to change credentials is

that blows up. I had to create a new configuration and reconfigure it for it to work. Same thing when changing from SSL to non secure or vice versa.

And going along the same line.. what if you're dealing with multiple servers that have different configurations? (and ideally, re-using whatever's possible..

Thanks
Stephan