MySQL Connector/Net Developer Guide  /  ...  /  MySql.Data.MySqlClient.Replication Namespace

11.2.3.5 MySql.Data.MySqlClient.Replication Namespace

This section of the manual contains the API reference for Replication and Load balancing components.

Classes

ClassDescription
ReplicationManagerManager for Replication and Load Balancing features.
ReplicationRoundRobinServerGroupClass that implements Round Robing Load Balancing technique.
ReplicationServerRepresents a server in Replication environment that contains information about
ReplicationServerGroupAbstract class used to implement a custom load balancing plugin
11.2.3.5.1 ReplicationManager Class

Members

Namespace: MySql.Data.MySqlClient.Replication

Assembly: MySql.Data (in MySql.Data.dll)

Syntax C#

public static class ReplicationManager
      

Syntax Visual Basic

Public NotInheritable Class ReplicationManager
      

Syntax Visual C++

public ref class ReplicationManager abstract sealed
      

See Also

ReplicationManager Members MySql.Data.MySqlClient.Replication Namespace

11.2.3.5.1.1 ReplicationManager Members

The ReplicationManager type exposes the following members.

Public Static Methods

NameDescription
AddGroup(String, Int32)Adds a Default Server Group to the list
AddGroup(String, String, Int32)Adds a Server Group to the list
GetGroupGets a Server Group by name
GetNewConnectionAssigns a new server driver to the connection object
GetServerGets the next server from a replication group
IsReplicationGroupValidates if the replication group name exists

Public Static Properties

NameDescription
GroupsReturns Replication Server Group List

See Also

ReplicationManager Class MySql.Data.MySqlClient.Replication Namespace

11.2.3.5.1.1.1 AddGroup Method

Overload List

See Also

ReplicationManager Class ReplicationManager Members MySql.Data.MySqlClient.Replication Namespace

11.2.3.5.1.1.1.1 ReplicationManager.AddGroup Method (String, Int32)

Adds a Default Server Group to the list

Syntax C#

public static ReplicationServerGroup AddGroup(
  string name,
  int retryTime
)
            

Syntax Visual Basic

Public Shared Function AddGroup ( _
  name As String, _
  retryTime As Integer _
) As ReplicationServerGroup
            

Syntax Visual C++

public:
static ReplicationServerGroup^ AddGroup(
  String^ name, 
  int retryTime
)
            

Parameters

name

Type: System.String

Group name

retryTime

Type: System.Int32

Time between reconnections for failed servers

Return Value

A ReplicationServerGroup object

See Also

ReplicationManager Class AddGroup Overload MySql.Data.MySqlClient.Replication Namespace

11.2.3.5.1.1.1.2 ReplicationManager.AddGroup Method (String, String, Int32)

Adds a Server Group to the list

Syntax C#

public static ReplicationServerGroup AddGroup(
  string name,
  string groupType,
  int retryTime
)
            

Syntax Visual Basic

Public Shared Function AddGroup ( _
  name As String, _
  groupType As String, _
  retryTime As Integer _
) As ReplicationServerGroup
            

Syntax Visual C++

public:
static ReplicationServerGroup^ AddGroup(
  String^ name, 
  String^ groupType, 
  int retryTime
)
            

Parameters

name

Type: System.String

Group name

groupType

Type: System.String

ServerGroup type reference

retryTime

Type: System.Int32

Time between reconnections for failed servers

Return Value

A ReplicationServerGroup object

See Also

ReplicationManager Class AddGroup Overload MySql.Data.MySqlClient.Replication Namespace

11.2.3.5.1.1.2 ReplicationManager.GetGroup Method

Gets a Server Group by name

Syntax C#

public static ReplicationServerGroup GetGroup(
string groupName
)
          

Syntax Visual Basic

Public Shared Function GetGroup ( _
groupName As String _
) As ReplicationServerGroup
          

Syntax Visual C++

public:
static ReplicationServerGroup^ GetGroup(
String^ groupName
)
          

Parameters

groupName

Type: System.String

Group name

Return Value

A ReplicationServerGroup object

See Also

ReplicationManager Class MySql.Data.MySqlClient.Replication Namespace

11.2.3.5.1.1.3 ReplicationManager.GetNewConnection Method

Assigns a new server driver to the connection object

Syntax C#

public static void GetNewConnection(
  string groupName,
  bool master,
  MySqlConnection connection
)
          

Syntax Visual Basic

Public Shared Sub GetNewConnection ( _
  groupName As String, _
  master As Boolean, _
  connection As MySqlConnection _
)
          

Syntax Visual C++

public:
static void GetNewConnection(
  String^ groupName, 
  bool master, 
  MySqlConnection^ connection
)
          

Parameters

groupName

Type: System.String

Group name

master

Type: System.Boolean

True if the server connection to assign must be a master

connection

Type: MySql.Data.MySqlClient.MySqlConnection

MySqlConnection object where the new driver will be assigned

See Also

ReplicationManager Class MySql.Data.MySqlClient.Replication Namespace

11.2.3.5.1.1.4 ReplicationManager.GetServer Method

Gets the next server from a replication group

Syntax C#

public static ReplicationServer GetServer(
  string groupName,
  bool isMaster
)
          

Syntax Visual Basic

Public Shared Function GetServer ( _
  groupName As String, _
  isMaster As Boolean _
) As ReplicationServer
          

Syntax Visual C++

public:
static ReplicationServer^ GetServer(
  String^ groupName, 
  bool isMaster
)
          

Parameters

groupName

Type: System.String

Group name

isMaster

Type: System.Boolean

True if the server to return must be a master

Return Value

A ReplicationServer object

See Also

ReplicationManager Class MySql.Data.MySqlClient.Replication Namespace

11.2.3.5.1.1.5 ReplicationManager.IsReplicationGroup Method

Validates if the replication group name exists.

Syntax C#

public static bool IsReplicationGroup(
  string groupName
)
          

Syntax Visual Basic

Public Shared Function IsReplicationGroup ( _
  groupName As String _
) As Boolean
          

Syntax Visual C++

public:
static bool IsReplicationGroup(
  String^ groupName
)
          

Parameters

groupName

Type: System.String

Group name

Return Value

True if replication group name is found, otherwise false

See Also

ReplicationManager Class MySql.Data.MySqlClient.Replication Namespace

11.2.3.5.1.1.6 ReplicationManager.Groups Property

Returns Replication Server Group List

Syntax C#

public static IList<ReplicationServerGroup> Groups { get; private set; }
          

Syntax Visual Basic

Public Shared Property Groups As IList(Of ReplicationServerGroup)
  Get
  Private Set
          

Syntax Visual C++

public:
static property IList<ReplicationServerGroup^>^ Groups {
  IList<ReplicationServerGroup^>^ get ();
  private: void set (IList<ReplicationServerGroup^>^ value);
}
          

See Also

ReplicationManager Class MySql.Data.MySqlClient.Replication Namespace

11.2.3.5.2 ReplicationRoundRobinServerGroup Class

Members

Namespace: MySql.Data.MySqlClient.Replication

Assembly: MySql.Data (in MySql.Data.dll)

Syntax C#

public class ReplicationRoundRobinServerGroup : ReplicationServerGroup
      

Syntax Visual Basic

Public Class ReplicationRoundRobinServerGroup _
  Inherits ReplicationServerGroup
      

Syntax Visual C++

public ref class ReplicationRoundRobinServerGroup : public ReplicationServerGroup
      

See Also

ReplicationRoundRobinServerGroup Members MySql.Data.MySqlClient.Replication Namespace

11.2.3.5.2.1 ReplicationRoundRobinServerGroup Members

The ReplicationRoundRobinServerGroup type exposes the following members.

Public Instance Constructors

NameDescription
ReplicationRoundRobinServerGroupInitializes a new instance of the ReplicationRoundRobinServerGroup class

Public Instance Methods

NameDescription
AddServerAdds a server into the group (Inherited from ReplicationServerGroup)
EqualsDetermines whether the specified Object is equal to the current Object. (Inherited from Object.)
GetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
GetServer(Boolean)Gets an available server based on Round Robin load balancing (Overrides ReplicationServerGroup.GetServer(Boolean).)
GetServer(String)Gets a server by name (Inherited from ReplicationServerGroup.)
GetTypeGets the Type of the current instance. (Inherited from Object.)
RemoveServerRemoves a server from group (Inherited from ReplicationServerGroup.)
ToStringReturns a string that represents the current object. (Inherited from Object.)

Public Instance Properties

NameDescription
Name(Inherited from ReplicationServerGroup.)
RetryTime(Inherited from ReplicationServerGroup.)
Servers(Inherited from ReplicationServerGroup.)

See Also

ReplicationRoundRobinServerGroup Class MySql.Data.MySqlClient.Replication Namespace

11.2.3.5.2.1.1 ReplicationRoundRobinServerGroup Constructor

Initializes a new instance of the ReplicationRoundRobinServerGroup class

Syntax C#

public ReplicationRoundRobinServerGroup(
  string name,
  int retryTime
)
          

Syntax Visual Basic

Public Sub New ( _
  name As String, _
  retryTime As Integer _
)
          

Syntax Visual C++

public:
ReplicationRoundRobinServerGroup(
  String^ name, 
  int retryTime
)
          

Parameters

name

Type: System.String

Server name

retryTime

Type: System.Int32

Retry time between connections to failed connections

See Also

ReplicationRoundRobinServerGroup Class MySql.Data.MySqlClient.Replication Namespace

11.2.3.5.2.1.2 GetServer Method

Overload List

See Also

ReplicationRoundRobinServerGroup Class ReplicationRoundRobinServerGroup Members MySql.Data.MySqlClient.Replication Namespace

11.2.3.5.2.1.2.1 ReplicationRoundRobinServerGroup.GetServer Method (Boolean)

Gets an available server based on Round Robin load balancing (Overrides ReplicationServerGroup.GetServer(Boolean).)

Syntax C#

public override ReplicationServer GetServer(
  bool isMaster
)
            

Syntax Visual Basic

Public Overrides Function GetServer ( _
  isMaster As Boolean _
) As ReplicationServer
            

Syntax Visual C++

public:
virtual ReplicationServer^ GetServer(
  bool isMaster
) override
            

Parameters

isMaster

Type: System.Boolean

True if the server to return must be a master

Return Value

A ReplicationServer object

See Also

ReplicationRoundRobinServerGroup Class GetServer Overload MySql.Data.MySqlClient.Replication Namespace

11.2.3.5.3 ReplicationServer Class

Members

Namespace: MySql.Data.MySqlClient.Replication

Assembly: MySql.Data (in MySql.Data.dll)

Syntax C#

public class ReplicationServer
      

Syntax Visual Basic

Public Class ReplicationServer
      

Syntax Visual C++

public ref class ReplicationServer
      

See Also

ReplicationServer Members MySql.Data.MySqlClient.Replication Namespace

11.2.3.5.3.1 ReplicationServer Members

The ReplicationServer type exposes the following members.

Public Instance Constructors

NameDescription
ReplicationServerInitializes a new instance of the ReplicationServer class

Public Instance Methods

NameDescription
EqualsDetermines whether the specified Object is equal to the current Object. (Inherited from Object.)
GetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
GetTypeGets the Type of the current instance. (Inherited from Object.)
ToStringReturns a string that represents the current object. (Inherited from Object.)

Public Instance Properties

NameDescription
ConnectionStringConnection string used to connect to the server
IsAvailableDefines if the server is available to be considered in load balancing
IsMasterDefines if the server is master (True) or slave
NameServer name

See Also

ReplicationServer Class MySql.Data.MySqlClient.Replication Namespace

11.2.3.5.3.1.1 ReplicationServer Constructor

Initializes a new instance of the ReplicationServer class

Syntax C#

public ReplicationServer(
  string name,
  bool isMaster,
  string connectionString
)
          

Syntax Visual Basic

Public Sub New ( _
  name As String, _
  isMaster As Boolean, _
  connectionString As String _
)
          

Syntax Visual C++

public:
ReplicationServer(
  String^ name, 
  bool isMaster, 
  String^ connectionString
)
          

Parameters

name

Type: System.String

Server name

isMaster

Type: System.Boolean

Defines if the server is master (True) or slave

connectionString

Type: System.String

Connection string used to connect to the server

See Also

ReplicationServer Class MySql.Data.MySqlClient.Replication Namespace

11.2.3.5.3.1.2 ReplicationServer.ConnectionString Property

Connection string used to connect to the server

Syntax C#

public string ConnectionString { get; private set; }
          

Syntax Visual Basic

Public Property ConnectionString As String
  Get
  Private Set
          

Syntax Visual C++

public:
property String^ ConnectionString {
  String^ get ();
  private: void set (String^ value);
}
          

See Also

ReplicationServer Class MySql.Data.MySqlClient.Replication Namespace

11.2.3.5.3.1.3 ReplicationServer.IsAvailable Property

Defines if the server is available to be considered in load balancing

Syntax C#

public bool IsAvailable { get; set; }
          

Syntax Visual Basic

Public Property IsAvailable As Boolean
  Get
  Set
          

Syntax Visual C++

public:
property bool IsAvailable {
  bool get ();
  void set (bool value);
}
          

See Also

ReplicationServer Class MySql.Data.MySqlClient.Replication Namespace

11.2.3.5.3.1.4 ReplicationServer.IsMaster Property

Defines if the server is master (True) or slave

Syntax C#

public bool IsMaster { get; private set; }
          

Syntax Visual Basic

Public Property IsMaster As Boolean
  Get
  Private Set
          

Syntax Visual C++

public:
property bool IsMaster {
  bool get ();
  private: void set (bool value);
}
          

See Also

ReplicationServer Class MySql.Data.MySqlClient.Replication Namespace

11.2.3.5.3.1.5 ReplicationServer.Name Property

Server name

Syntax C#

public string Name { get; private set; }
          

Syntax Visual Basic

Public Property Name As String
  Get
  Private Set
          

Syntax Visual C++

public:
property String^ Name {
  String^ get ();
  private: void set (String^ value);
}
          

See Also

ReplicationServer Class MySql.Data.MySqlClient.Replication Namespace

11.2.3.5.4 ReplicationServerGroup Class

Members

Base class used to implement load balancing features

Namespace: MySql.Data.MySqlClient.Replication

Assembly: MySql.Data (in MySql.Data.dll)

Syntax C#

public abstract class ReplicationServerGroup
      

Syntax Visual Basic

Public MustInherit Class ReplicationServerGroup
      

Syntax Visual C++

public ref class ReplicationServerGroup abstract
      

See Also

ReplicationServerGroup Members MySql.Data.MySqlClient.Replication Namespace

11.2.3.5.4.1 ReplicationServerGroup Members

The ReplicationServerGroup type exposes the following members.

Public Instance Constructors

NameDescription
ReplicationServerGroupInitializes a new instance of the ReplicationServerGroup class

Public Instance Methods

NameDescription
AddServerAdds a server into the group
EqualsDetermines whether the specified Object is equal to the current Object. (Inherited from Object.)
GetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
GetServer(Boolean)Must be implemented. Defines the next server for a custom load balancing implementation.
GetServer(String)Gets a server by name.
GetTypeGets the Type of the current instance. (Inherited from Object.)
RemoveServerRemoves a server from group.
ToStringReturns a string that represents the current object. (Inherited from Object.)

Public Instance Properties

NameDescription
NameGroup name
RetryTimeRetry time between connections to failed servers
ServersServers list in the group

See Also

ReplicationServerGroup Class MySql.Data.MySqlClient.Replication Namespace

11.2.3.5.4.1.1 ReplicationServerGroup Constructor

Initializes a new instance of the ReplicationServerGroup class

Syntax C#

public ReplicationServerGroup(
  string name,
  int retryTime
)
          

Syntax Visual Basic

Public Sub New ( _
  name As String, _
  retryTime As Integer _
)
          

Syntax Visual C++

public:
ReplicationServerGroup(
  String^ name, 
  int retryTime
)
          

Parameters

name

Type: System.String

Group name

retryTime

Type: System.Int32

Retry time between connections to failed servers

See Also

ReplicationServerGroup Class MySql.Data.MySqlClient.Replication Namespace

11.2.3.5.4.1.2 ReplicationServerGroup.AddServer Method

Adds a server into the group.

Syntax C#

public ReplicationServer AddServer(
  string name,
  bool isMaster,
  string connectionString
)
          

Syntax Visual Basic

Public Function AddServer ( _
  name As String, _
  isMaster As Boolean, _
  connectionString As String _
) As ReplicationServer
          

Syntax Visual C++

public:
ReplicationServer^ AddServer(
  String^ name, 
  bool isMaster, 
  String^ connectionString
)
          

Parameters

name

Type: System.String

Server name

isMaster

Type: System.Boolean

True if the server to add is master, False for slave server

connectionString

Type: System.String

Connection string used by this server

See Also

ReplicationServerGroup Class MySql.Data.MySqlClient.Replication Namespace

11.2.3.5.4.1.3 GetServer Method

Overload List

See Also

ReplicationServerGroup Class ReplicationServerGroup Members MySql.Data.MySqlClient.Replication Namespace

11.2.3.5.4.1.3.1 ReplicationServerGroup.GetServer Method (Boolean)

Must be implemented. Defines the next server for a custom load balancing implementation.

Syntax C#

public abstract ReplicationServer GetServer(
  bool isMaster
)
            

Syntax Visual Basic

Public MustOverride Function GetServer ( _
  isMaster As Boolean _
) As ReplicationServer
            

Syntax Visual C++

public:
virtual ReplicationServer^ GetServer(
  bool isMaster
) abstract
            

Parameters

isMaster

Type: System.Boolean

Defines if the server to return is a master or any

Return Value

A ReplicationServer object

See Also

ReplicationServerGroup Class GetServer Overload MySql.Data.MySqlClient.Replication Namespace

11.2.3.5.4.1.3.2 ReplicationServerGroup.GetServer Method (String)

Gets a server by name.

Syntax C#

public ReplicationServer GetServer(
  string name
)
            

Syntax Visual Basic

Public Function GetServer ( _
  name As String _
) As ReplicationServer
            

Syntax Visual C++

public:
ReplicationServer^ GetServer(
  String^ name
)
            

Parameters

name

Type: System.String

Server name

Return Value

A ReplicationServer object

See Also

ReplicationServerGroup Class GetServer Overload MySql.Data.MySqlClient.Replication Namespace

11.2.3.5.4.1.4 ReplicationServerGroup.RemoveServer Method

Removes a server from group.

Syntax C#

public void RemoveServer(
  string name
)
          

Syntax Visual Basic

Public Sub RemoveServer ( _
  name As String _
)
          

Syntax Visual C++

public:
void RemoveServer(
  String^ name
)
          

Parameters

name

Type: System.String

Server name

See Also

ReplicationServerGroup Class MySql.Data.MySqlClient.Replication Namespace

11.2.3.5.4.1.5 ReplicationServerGroup.Name Property

Group name.

Syntax C#

public string Name { get; private set; }
          

Syntax Visual Basic

Public Property Name As String
  Get
  Private Set
          

Syntax Visual C++

public:
property String^ Name {
  String^ get ();
  private: void set (String^ value);
}
          

See Also

ReplicationServerGroup Class MySql.Data.MySqlClient.Replication Namespace

11.2.3.5.4.1.6 ReplicationServerGroup.RetryTime Property

Retry time between connections to failed servers.

Syntax C#

public int RetryTime { get; private set; }
          

Syntax Visual Basic

Public Property RetryTime As Integer
  Get
  Private Set
          

Syntax Visual C++

public:
property int RetryTime {
  int get ();
  private: void set (int value);
}
          

See Also

ReplicationServerGroup Class MySql.Data.MySqlClient.Replication Namespace

11.2.3.5.4.1.7 ReplicationServerGroup.Servers Property

Servers list in the group.

Syntax C#

public IList<ReplicationServer> Servers { get; private set; }
          

Syntax Visual Basic

Public Property Servers As IList(Of ReplicationServer)
  Get
  Private Set
          

Syntax Visual C++

public:
property IList<ReplicationServer^>^ Servers {
  IList<ReplicationServer^>^ get ();
  private: void set (IList<ReplicationServer^>^ value);
}
          

See Also

ReplicationServerGroup Class MySql.Data.MySqlClient.Replication Namespace


User Comments
Sign Up Login You must be logged in to post a comment.