ページの先頭行へ戻る
Enterprise Postgres 14 SP1 導入ガイド(クライアント編)
FUJITSU Software

2.4.1 machine.configファイルのエントリへの登録

マルチバージョンインストール時に、アプリケーションごとに利用するNpgsqlのバージョンを使い分けたい場合は、machine.configファイルのDbProviderFactoriesセクションに、異なるinvariant値を持つエントリを複数登録し、アプリケーションごとに利用する値を使い分けることで実現できます。

NpgsqlRegister.exeは富士通が提供するツールです。

NpgsqlRegister.exeツールの使用により以下を行うことができます。

注意

  • 既存のinvariant値を変更する際には、既存のDbProviderのエントリに注意して編集する必要があります。編集中のDbProviderのエントリを使用しているアプリケーションがないかどうかを必ず確認してください。

  • 将来的にマルチバージョンのNpgsqlをインストールする可能性がある場合は、新しいinvariant属性を追加して使用することを推奨します。

このツールの格納場所と、このツールを使用して、インストールするバージョンに合わせてmachine.configエントリを登録する方法について以下に説明します。

NpgsqlRegister.exeの格納場所

NpgsqlRegister.exeツールは以下の場所に格納されています。

<FUJITSU Enterprise Postgresクライアント機能のインストールディレクトリ>\dotnet\NpgsqlRegister.exe

NpgsqlRegister.exeツールを使用するためには、.NET Framework 4.6.1以降がインストールされている必要があります。インストールされていない場合、.NET Framework 4.6.1以降をインストール後、このコマンドを再実行してください。

NpgsqlRegister.exeの利用方法

管理者権限を持つユーザーで、以下のコマンドを実行します。

> NpgsqlRegister.exe

NpgsqlRegister.exeツールはFUJITSU Enterprise Postgresのinvariant値を確認します。machine.configファイルにFUJITSU Enterprise Postgresのinvariant値が存在しない場合は、現在のバージョンを持つinvariant値(FUJITSU.Npgsql)がmachine.configに登録され、ユーザーに通知されます。machine.configファイルにFUJITSU Enterprise Postgresのinvariant値が存在する場合は、次のオプションが表示されます。

1 - Edit an existing DbProvider entry to point to the current version
2 - Add a new Invariant alias DbProvider entry to point to the current version
3 - Exit
既存のDbProviderのエントリを編集する方法

このオプションを選択すると、既存のDbProviderエントリを使用しているアプリケーションが、インストールされている最新のNpgsqlバージョンをGACから参照できるようになります。

machine.configファイルに存在するすべてのFUJITSU Enterprise Postgres Npgsqlのinvariant名エントリのリストが、以下のように表示されます。

Please select the Invariant attribute you would like to point
to the current version.
1 - Invariant attribute: FUJITSU.Npgsql. fep13, Npgsql Version: 13.0.0.0
2 - Invariant attribute: FUJITSU.Npgsql. fep14, Npgsql Version: 14.0.0.0
3 - Invariant attribute: Npgsql, Npgsql Version: 14.0.0.0
4 - Exit

一覧で表示されているinvariant値を1つ選択すると、machine.configのエントリが、本バージョンのNpgsqlをポイントするように更新され、そのinvariant値を参照する既存のアプリケーションは、本バージョンのNpgsqlを参照するようになります。

DbProviderに新しいエントリを追加する方法

このオプションを選択すると、新しいinvariant値を登録できます。登録された新しいinvariant値をアプリケーションから参照すると、本FUJITSU Enterprise PostgresのバージョンのNpgsqlが参照されます。

新しいinvariant値を追加するオプションを選択すると、以下が表示されます。

You have chosen to add a new DbProvider entry with an Invariant Alias to the machine.config

The Invariant attribute can either be in the form of 2 user defined formats (define xyz):
1 - 'FUJITSU.Npgsql.xyz'
2 - 'Npgsql.xyz'

or add a DbProvider entry with Invariant attribute set to 'Npgsql'
3 - 'Npgsql'
4 - Exit

Please enter one of the options (1 .. 4):

最初の2つのオプションは “xyz”に任意の値を指定することで、任意のinvariant値を作成できます。ただし、ユーザーが指定できるのは、最低1文字の半角英数字を含み、10文字を超えない文字列です。

3つ目のオプションは、invariant値“Npgsql”を新しく登録します。

指定した値がすでに利用されている場合は、以下の警告が出力されます。

A DbProvider entry with Invariant attribute 'Npgsql' already exists in machine.config
If you require this Invariant attribute, restart the application and choose 'Edit an existing DbProvider entry'