Share via


DataConnection.Clone Method

Creates a cloned instance of this data connection, which retains the same connection properties and state as the original.

Namespace:  Microsoft.VisualStudio.Data
Assembly:  Microsoft.VisualStudio.Data (in Microsoft.VisualStudio.Data.dll)

Syntax

'Declaration
Public MustOverride Function Clone As DataConnection
public abstract DataConnection Clone()
public:
virtual DataConnection^ Clone() abstract
abstract Clone : unit -> DataConnection
public abstract function Clone() : DataConnection

Return Value

Type: Microsoft.VisualStudio.Data.DataConnection
Returns a cloned instance of the current DataConnection object instance, with the same connection properties and state as the original.

Remarks

This method can be useful when a client wishes to perform an action with a connection on a background thread and does not want to hold up the main connection while the action is processing.

The cloned connection assumes the same state as the original; that is, if the original was closed, the new one is also closed.

Note

Any exceptions that occur indicate that the cloned data connection was unable to initialize itself to the same state as this connection due to a provider specific problem.

.NET Framework Security

See Also

Reference

DataConnection Class

Microsoft.VisualStudio.Data Namespace