Connection String ConfiguratorNamed Method
Use the connection string with the given name from the app.config file.
Definition
Namespace: SphinxConnector.FluentApi
Assembly: SphinxConnector (in SphinxConnector.dll) Version: 6.1.0
Assembly: SphinxConnector (in SphinxConnector.dll) Version: 6.1.0
C#
public void Named(
string connectionStringName
)VB
Public Sub Named (
connectionStringName As String
)Parameters
- connectionStringName String
- The name of the connection string in the app.config file.
Example
Suppose your app.config looks like this:
You can then configure the FulltextStore class to use that connection string like this:
C#
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<connectionStrings>
<add name="SphinxConnectionString" connectionString="datasource=192.168.105;port=9306"/>
</connectionStrings>
</configuration>You can then configure the FulltextStore class to use that connection string like this:
C#
IFulltextStore fulltextStore = new FulltextStore().Initialize();
fulltextStore.ConnectionString.Named("SphinxConnectionString");Exceptions
| ArgumentNullException | Occurs when the provided string is null. |
| ArgumentException | Occurs when the provided string is empty. |
| InvalidOperationException | Occurs in case the connection string has already been set. |