WebSecurity- InitializeDatabaseConnection()
❮WebSecurity
意味
InitializeDatabaseConnection()メソッドは、WebSecurityデータベースを初期化します。
このメソッド は、ユーザーおよびメンバーシップ情報を含むデータベースに接続することにより、 WebSecurityシステムを初期化します。
C#およびVB構文
WebSecurity.InitializeDatabaseConnection(connectionString, userTableName,
userIdColumn, userNameColumn, autoCreateTables)
パラメーター
Parameter | Type | Description |
---|---|---|
connectionString | String |
The name of your WebSecurity database (se remarks) |
userTableName | String | The database table that contains the user profile information |
userIdColumn | String | The database column that contains the user IDs (primary keys) |
userNameColumn | String | The database column that contains the user names |
autoCreateTables | Boolean | true indicates that user profile and membership tables should be created if they do not exist, otherwise false |
戻り値
なし。
備考
SQL Server Compactを使用している場合、connectionString はWebSecurityデータベースの名前(.sdfファイル名拡張子なし)である必要があります。それ以外の場合は、Web構成(web.configファイル)の接続文字列の名前にする必要があります。
autoCreateTablesでデータベーステーブル を強制的に自動的に作成できる場合でも、 データベース自体は常に存在している必要があります。
エラーと例外
InitializeDatabaseConnection()メソッドは、次の場合にInvalidOperationExceptionをスローします。
- SimpleMembershipが初期化されていない(またはWebサイト構成で無効になっている)
❮WebSecurity