ComponentOne ADO.NET DataExtender
C1.C1DataExtender.2 Assembly / C1.C1DataExtender Namespace / C1DataViewSet Class / ConnectionCatalogs Property

In This Topic
    ConnectionCatalogs Property
    In This Topic
    Defines a set of catalogs (databases) that should be retrieved from server when C1DataViewSet is connected to a data source via the ConnectionString property and ConnectionProvider is SqlClient provider.
    Syntax
    'Declaration
     
    Public ReadOnly Property ConnectionCatalogs As CatalogCollection
    public CatalogCollection ConnectionCatalogs {get;}
    Remarks
    The ConnectionCatalogs property has an effect only if C1DataViewSet is connected to a data source via the ConnectionString property and ConnectionProvider is SqlClient provider. In all other cases this property is ignored.

    If this collection is empty then data is retrieved from a catalog specified in the "Initial Catalog" parameter of the ConnectionString property. Each item of the collection is a name of a catalog (database) from the server referenced in the ConnectionString property, or a catalog name from a linked server registered on the server referenced in the ConnectionString property. In the letter case the name must be specified in the form of linked_server_name.catalog_name. An empty item denotes a default catalog specified in the "Initial Catalog" parameter of the ConnectionString property.

    For example, let's suppose that ConnectionString is set to "Data Source=(local);Initial Catalog=NorthWind;Integrated Security=True" and ConnectionCatalogs has the following list of items: "" (empty string), "AdventureWorks" and "LinkedServer.NorthWind". In this case the following databases will be retrieved to C1DataViewSet respectively: local NorthWind database, local AdventureWorks database and the NorthWind database from the linked server LinkedServer registered on the local server.

    In order to provide an ability to commit data changes to databases from linked servers, make sure that the following conditions are satisfied:

    • Microsoft Distributed Transaction Coordinator is started for SQL Server that C1DataViewSet is connected to.
    • RPC calls to the linked server are allowed in the linked server definition. To enable it in the SQL Server 2008 Management Studio, in the linked server properties window, "Server Options" page, set the "RPC Out" option to true.

    By default, when C1DataViewSet imports DataSet structure from server, it adds the catalog name prefixes to created DataTables' names, with dots replaced by underscores. For example, a DataTable representing the Customers table from the "LinkedServer.NorthWind" database will get the "LinkedServer_NorthWind_Customers" name. The tables corresponding to the default catalog (denoted by an empty string item in the ConnectionCatalogs collection) doesn't get such a prefix. This behavior can be changed by setting the ConnectionAddTablePrefixes property to false, in this case the prefixes will not be added to the DataTable names. In case of name conflicts, that is when a table with the same name exists in multiple referenced catalogs, the name of each conflicting table will be suffixed with and unique number. For the example above, the Customers table from the local server will be named "Customers", and the Customers table from the linked server will be named "Customers2". Note that the catalogs are processed in the same order as they go in the collection.

    Any change in the ConnectionCatalogs collection causes C1DataViewSet to re-fetch the whole DataSet structure. If in run-time you need to perform multiple changes to the collection at once then it's recommended to wrap those changes with the BeginUpdate and EndUpdate method calls, in this case the data fetching will be performed only once after the EndUpdate method is called, which will cut down the time necessary to perform this operation.

    See Also