SqlCeReplication.SaveProperties 메서드

현재 구독에 대해 Replication 클래스 속성에 저장된 모든 값을 검색하여 시스템 테이블에 저장합니다.

네임스페이스: System.Data.SqlServerCe
어셈블리: System.Data.SqlServerCe(system.data.sqlserverce.dll)

구문

‘선언
Public Sub SaveProperties
‘사용 방법
Dim instance As SqlCeReplication

instance.SaveProperties
public void SaveProperties ()
public:
void SaveProperties ()
public void SaveProperties ()
public function SaveProperties ()

설명

먼저 구독이 만들어져 있어야 동기화 속성을 저장할 수 있습니다. 동기화 실행에 필요한 모든 매개 변수가 제공되어야 SaveProperties를 정상적으로 호출할 수 있습니다. 동기화 속성을 저장할 때 선택적 매개 변수를 생략하게 되면 저장된 동기화 속성이 이미 존재하더라도 이러한 매개 변수에는 기본값이 설정됩니다. 속성을 덮어쓰지 않게 하려면 사용자는 우선 LoadProperties를 호출하여 동기화 속성을 검색하고 특정 속성을 변경한 다음 동기화 속성을 다시 저장해야 합니다.

SaveProperties가 호출되면 암호 속성의 값이 데이터베이스에 저장됩니다. 이러한 값은 고유한 장치 하드웨어 키를 사용하여 자동으로 암호화됩니다.. 따라서 한 장치(또는 서버)에서 구독 프로필을 만든 다음 해당 데이터베이스를 새 장치로 복사하면 LoadProperties는 프로필에서 암호를 검색하지 못합니다. 정확한 암호를 직접 제공한 다음 SaveProperties를 다시 호출하여 해당 프로필이 새 장치에 남아 있도록 할 수 있습니다.

예제

다음 예제에서는 SaveProperties 메서드를 사용하는 방법을 보여 줍니다.

Dim repl As SqlCeReplication = Nothing

Try
    ' Create SqlCeReplication instance
    '
    repl = New SqlCeReplication()
    repl.InternetUrl = "https://www.adventure-works.com/sqlmobile/sqlcesa30.dll"
    repl.InternetLogin = "MyInternetLogin"
    repl.InternetPassword = "<password>"
    repl.Publisher = "MyPublisher"
    repl.PublisherDatabase = "MyPublisherDatabase"
    repl.PublisherLogin = "MyPublisherLogin"
    repl.PublisherPassword = "<password>"
    repl.Publication = "MyPublication"
    repl.Subscriber = "MySubscriber"
    repl.SubscriberConnectionString = "Data Source=MyDatabase.sdf"

    ' Store all the properties in the database
    '
    repl.SaveProperties()

    ' In the future all you need to do is load the properties
    '
    repl = New SqlCeReplication()
    repl.SubscriberConnectionString = "Data Source='Test.sdf'; Pwd='<password>'"
    repl.LoadProperties()

    ' Now the SqlCeReplication instance is ready to sync
    '
    repl.Synchronize()

Catch
    ' Handle errors here
Finally
    ' Dispose the repl object
    '
    repl.Dispose()
End Try
SqlCeReplication repl = null;

try
{
    // Create SqlCeReplication instance
    //
    repl = new SqlCeReplication();
    repl.InternetUrl = "https://www.adventure-works.com/sqlmobile/sqlcesa30.dll";
    repl.InternetLogin = "MyInternetLogin";
    repl.InternetPassword = "<password>";
    repl.Publisher = "MyPublisher";
    repl.PublisherDatabase = "MyPublisherDatabase";
    repl.PublisherLogin = "MyPublisherLogin";
    repl.PublisherPassword = "<password>";
    repl.Publication = "MyPublication";
    repl.Subscriber = "MySubscriber";
    repl.SubscriberConnectionString = "Data Source=MyDatabase.sdf";

    // Store all the properties in the database
    //
    repl.SaveProperties();

    // In the future all you need to do is load the properties
    //
    repl = new SqlCeReplication();
    repl.SubscriberConnectionString = "Data Source='Test.sdf'; Pwd='<password>'";
    repl.LoadProperties();

    // Now the SqlCeReplication instance is ready to sync
    //
    repl.Synchronize();

}
catch (SqlCeException)
{
    // Handle errors here
}
finally
{
    // Dispose the repl object
    //
    repl.Dispose();
}

.NET Framework 보안

  • 직접 실행 호출자의 경우 완전히 신뢰합니다. 이 멤버는 부분적으로 신뢰할 수 있는 코드에서 사용할 수 없습니다. 자세한 내용은 을(를) 참조하십시오.

플랫폼

Windows CE, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows XP Professional x64 Edition, Windows XP SP2

.NET Framework에서 모든 플래폼의 모든 버전을 지원하지는 않습니다. 지원되는 버전의 목록은 시스템 요구 사항을 참조하십시오.

버전 정보

.NET Compact Framework

2.0에서 지원

참고 항목

참조

SqlCeReplication 클래스
SqlCeReplication 멤버
System.Data.SqlServerCe 네임스페이스