ObjectSchema 属性
获取或设置 Sync Framework 创建对象所采用的数据库架构。
命名空间: Microsoft.Synchronization.Data.SqlServer
程序集: Microsoft.Synchronization.Data.SqlServer(在 Microsoft.Synchronization.Data.SqlServer.dll 中)
语法
声明
Public Property ObjectSchema As String
Get
Set
用法
Dim instance As SqlSyncScopeProvisioning
Dim value As String
value = instance.ObjectSchema
instance.ObjectSchema = value
public string ObjectSchema { get; set; }
public:
property String^ ObjectSchema {
String^ get ();
void set (String^ value);
}
member ObjectSchema : string with get, set
function get ObjectSchema () : String
function set ObjectSchema (value : String)
属性值
类型:System. . :: . .String
Sync Framework 创建对象所采用的数据库架构。
示例
下面的代码示例设置一个 SQL Server 数据库。设置基于作用域信息,这些信息是通过调用 GetDescriptionForScope 并且指定作用域名称 ("filtered_customer")、在 SQL Server Compact 数据库中使用的可选对象前缀名称(在此情况下为 "Sync")以及连接,从 SQL Server Compact 数据库检索的。SQL Server Compact 数据库不支持单独的架构,因此我们在所有与同步相关的对象名称之前加上前缀 "Sync",以便它们易于标识。对于 SQL Server 数据库,我们指定可选数据库架构(Sync Framework 在其中存储同步对象,在此情况下为 "Sync",但不要求值与对象前缀匹配)。若要在完整示例上下文中查看此代码,请参见如何配置和执行数据库同步 (SQL Server)。
DbSyncScopeDescription clientSqlDesc = SqlCeSyncDescriptionBuilder.GetDescriptionForScope("filtered_customer", "Sync", clientSqlCe1Conn);
SqlSyncScopeProvisioning clientSqlConfig = new SqlSyncScopeProvisioning(clientSqlConn, clientSqlDesc);
clientSqlConfig.ObjectSchema = "Sync";
clientSqlConfig.Apply();
Dim clientSqlDesc As DbSyncScopeDescription = _
SqlCeSyncDescriptionBuilder.GetDescriptionForScope("filtered_customer", "Sync", clientSqlCe1Conn)
Dim clientSqlConfig As New SqlSyncScopeProvisioning(clientSqlConn, clientSqlDesc)
clientSqlConfig.ObjectSchema = "Sync"
clientSqlConfig.Apply()