DbSyncColumnDescription Class

Represents the schema of a column that is included in the Columns list of a DbSyncTableDescription object. This is used during database provisioning.

Inheritance Hierarchy

System.Object
  Microsoft.Synchronization.Data.DbSyncColumnDescription

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

Syntax

'Declaration
<SerializableAttribute> _
Public Class DbSyncColumnDescription
'Usage
Dim instance As DbSyncColumnDescription
[SerializableAttribute]
public class DbSyncColumnDescription
[SerializableAttribute]
public ref class DbSyncColumnDescription
[<SerializableAttribute>]
type DbSyncColumnDescription =  class end
public class DbSyncColumnDescription

The DbSyncColumnDescription type exposes the following members.

Constructors

  Name Description
Public method DbSyncColumnDescription() Initializes a new instance of the DbSyncColumnDescription class by using default values.
Public method DbSyncColumnDescription(String, String) Initializes a new instance of the DbSyncColumnDescription class for a column that has the specified name and data type.

Top

Properties

  Name Description
Public property AutoIncrementSeed Gets or sets the starting value for a column that automatically increments its value when new rows are inserted into the table.
Public property AutoIncrementSeedSpecified Gets or sets whether a value is specified for the AutoIncrementSeed property.
Public property AutoIncrementStep Gets or sets the increment step value for a column that automatically increments its value when new rows are inserted into the table.
Public property AutoIncrementStepSpecified Gets or sets whether a value is specified for the AutoIncrementStep property.
Public property DefaultValue Gets or sets the default value for the column when new rows are created.
Public property DefaultValueSpecified Gets or sets whether a value is specified for the DefaultValue property.
Public property IsNullable Gets or sets a value that indicates whether null values are allowed in this column.
Public property IsNullableSpecified Gets or sets whether a value is specified for the IsNullable property.
Public property IsPrimaryKey Gets or sets whether this column is part of the primary key for the table.
Public property IsPrimaryKeySpecified Gets or sets whether a value is specified for the IsPrimaryKey property.
Public property ParameterName Gets or sets the name of the parameter that is used to represent this column in synchronization queries.
Public property Precision Gets or sets the precision for the column if the data type is numeric.
Public property PrecisionSpecified Gets or sets whether a value is specified for the Precision property.
Public property QuotedName Gets the name of the column with database-specific delimiters.
Public property Scale Gets or sets the scale for the column if the data type is numeric and has a decimal component.
Public property ScaleSpecified Gets or sets whether a value is specified for the Scale property.
Public property Size Gets or sets the size of the column.
Public property SizeSpecified Gets or sets whether a value is specified for the Size property.
Public property Type Gets or sets the data type of the column.
Public property UnquotedName Gets or sets the name of the column without database-specific delimiters.

Top

Methods

  Name Description
Public method Equals (Inherited from Object.)
Protected method Finalize (Inherited from Object.)
Public method GetHashCode (Inherited from Object.)
Public method GetType (Inherited from Object.)
Protected method MemberwiseClone (Inherited from Object.)
Public method ToString Returns a string that represents the DbSyncColumnDescription object. (Overrides Object.ToString().)

Top

Examples

The following code example describes a scope named filtered_customer, and adds three tables to the scope: Customer, CustomerContact, and NewTable. The first two tables already exist in the server database, so the GetDescriptionForTable method is used to retrieve the schema from the server database. All columns from the Customer table are included, but only two columns from the CustomerContact table are included. The NewTable table is defined by using DbSyncTableDescription and DbSyncColumnDescription objects, and then the table is created in the server database (and in the other databases that synchronize with it). To view this code in the context of a complete example, see How To: Execute Database Synchronization (SQL Server).

DbSyncScopeDescription scopeDesc = new DbSyncScopeDescription("filtered_customer");

// Definition for Customer.
DbSyncTableDescription customerDescription =
    SqlSyncDescriptionBuilder.GetDescriptionForTable("Sales.Customer", serverConn);
scopeDesc.Tables.Add(customerDescription);


// Definition for CustomerContact, including the list of columns to include.
Collection<string> columnsToInclude = new Collection<string>();
columnsToInclude.Add("CustomerId");
columnsToInclude.Add("PhoneType");
DbSyncTableDescription customerContactDescription =
    SqlSyncDescriptionBuilder.GetDescriptionForTable("Sales.CustomerContact", columnsToInclude, serverConn);

scopeDesc.Tables.Add(customerContactDescription);

DbSyncTableDescription newTableDescription = new DbSyncTableDescription("Sales.NewTable");

DbSyncColumnDescription newTableIdCol = new DbSyncColumnDescription();
DbSyncColumnDescription newTableContentCol = new DbSyncColumnDescription();

newTableIdCol.UnquotedName = "NewTableId";
newTableIdCol.Type = "int";
newTableIdCol.IsPrimaryKey = true;

newTableContentCol.UnquotedName = "NewTableContent";
newTableContentCol.Type = "nvarchar";
newTableContentCol.Size = "100";
newTableContentCol.IsPrimaryKey = false;

newTableDescription.Columns.Add(newTableIdCol);
newTableDescription.Columns.Add(newTableContentCol);
scopeDesc.Tables.Add(newTableDescription);
Dim scopeDesc As New DbSyncScopeDescription("filtered_customer")

' Definition for Customer. 
Dim customerDescription As DbSyncTableDescription = SqlSyncDescriptionBuilder.GetDescriptionForTable("Sales.Customer", serverConn)
scopeDesc.Tables.Add(customerDescription) 


' Definition for CustomerContact, including the list of columns to include. 
Dim columnsToInclude As New Collection(Of String)()
columnsToInclude.Add("CustomerId") 
columnsToInclude.Add("PhoneType") 
Dim customerContactDescription As DbSyncTableDescription = SqlSyncDescriptionBuilder.GetDescriptionForTable("Sales.CustomerContact", columnsToInclude, serverConn)

scopeDesc.Tables.Add(customerContactDescription) 

Dim newTableDescription As New DbSyncTableDescription("Sales.NewTable")

Dim newTableIdCol As New DbSyncColumnDescription()
Dim newTableContentCol As New DbSyncColumnDescription()

newTableIdCol.UnquotedName = "NewTableId" 
newTableIdCol.Type = "int" 
newTableIdCol.IsPrimaryKey = True 

newTableContentCol.UnquotedName = "NewTableContent" 
newTableContentCol.Type = "nvarchar" 
newTableContentCol.Size = "100" 
newTableContentCol.IsPrimaryKey = False 

newTableDescription.Columns.Add(newTableIdCol) 
newTableDescription.Columns.Add(newTableContentCol) 
scopeDesc.Tables.Add(newTableDescription) 

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

Microsoft.Synchronization.Data Namespace