Skip to main content

This is documentation for Caché & Ensemble. See the InterSystems IRIS version of this content.Opens in a new tab

For information on migrating to InterSystems IRISOpens in a new tab, see Why Migrate to InterSystems IRIS?

構成情報のロード

接続情報をプログラムにロードするには、ConfigurationManager.AppSettings クラスの Get メソッドを使用します。これに、接続文字列を作成する値を指定します。PhonebookObjInitConnection メソッドを使用した例を次に示します。


private void InitConnection()
{
  //Retrieve connection information from the configuration file.
  string server = ConfigurationManager.AppSettings.Get("server");
  string logfile = ConfigurationManager.AppSettings.Get("logfile");
  string port = ConfigurationManager.AppSettings.Get("port");
  string nspace = ConfigurationManager.AppSettings.Get("namespace");
  string user = ConfigurationManager.AppSettings.Get("user");
  string pwd = ConfigurationManager.AppSettings.Get("pwd");
  string cacheConnectStr = "Server = " + server + "; Log File = " + logfile + 
      ";Port = " + port + "; Namespace = " + nspace + "; Password = " + pwd + 
      "; User ID = " + user; 
  
  cnCache = new CacheConnection(cacheConnectStr);
  cnCache.Open();
 }

FeedbackOpens in a new tab