共用方式為


Database Connections

Sync Framework makes at least two connections during synchronization to the two peers. Additional connections are required in N-tier and service-based architectures. Sync Framework makes these connections by using ADO.NET. Be aware of the following behavior:

  • For performance reasons, the DbSyncProvider uses ADO.NET connection pooling. Connection pooling can retain a physical connection to a SQL Server database even if synchronization is not running. Typically, this is not an issue. However, if you must drop the physical connection, call ClearPool.

  • Connection strings that are passed to DbSyncProvider must always include the name of the database from which tables will be synchronized, as shown in the following example:

    Data Source=localhost; Initial Catalog=AdventureWorks; Integrated Security=True;
    
  • Connection strings that represent a database and are passed to SqlSyncProvider are typically of the following general form:

    Server=tcp:<server name>;Database=<database name>;User ID=<user name>;Password=<myPassword>;Trusted_Connection=False;Encrypt=True;
    

    The connection string for a database can be retrieved from the Windows Azure Developer Portal by selecting the database, clicking the Connection Strings button, and copying the ADO.NET connection string to the clipboard. You might also need to add a rule to the Firewall Settings for your account to allow access to the database.

For information about how to secure connections, see Security Considerations.

請參閱

概念

Considerations for Application Design and Deployment