You are currently browsing legacy 3.0 version of documentation. Click here to switch to the newest 5.1 version.
Commands: How to switch commands credentials?
By default, commands available directly in store are working with credentials that were set up for that store. To use different credentials for commands use With method.
Syntax
IDatabaseCommands With(ICredentials credentialsForSession);
Parameters | ||
---|---|---|
credentialsForSession | ICredentials | credentials that should be used by new commands |
Return Value | |
---|---|
IDatabaseCommands | New instance of commands that will use given credentials. |
Example
IDatabaseCommands commands = store
.DatabaseCommands
.With(new NetworkCredential("otherUserName", "otherPassword"));