6.4.6.5 Clone
このメソッドは、OracleConnection
オブジェクトのコピーを作成します。
宣言
// C# public object Clone();
戻り値
OracleConnection
オブジェクト。
実装
ICloneable
備考
複製されたオブジェクトのプロパティ値は、複製元のオブジェクトのプロパティ値と同じです。
備考(.NETストアド・プロシージャ)
このメソッドは、暗黙的なデータベース接続ではサポートされていません。
例
// C# using System; using Oracle.DataAccess.Client; class CloneSample { static void Main() { string constr = "User Id=scott;Password=tiger;Data Source=oracle"; OracleConnection con = new OracleConnection(constr); con.Open(); // Need a proper casting for the return value when cloned OracleConnection clonedCon = (OracleConnection)con.Clone(); // Cloned connection is always closed, regardless of its source, // But the connection string should be identical clonedCon.Open(); if (clonedCon.ConnectionString.Equals(con.ConnectionString)) Console.WriteLine("The connection strings are the same."); else Console.WriteLine("The connection strings are different."); // Close and Dispose OracleConnection object clonedCon.Dispose(); } }