combit List & Label 29 - .NET Help
Programming Introduction / Other Important Concepts / Dataproviders
In This Topic
    Dataproviders
    In This Topic

    Providing data in List & Label is done with data providers. These are classes that implement the interface IDataProvider from the combit.Reporting.DataProviders namespace. Within this namespace a lot of classes are already contained which can act as a data provider.

    For data formats that are apparently not directly supported, a suitable provider is found in most cases anyway. Business data from applications can generally be passed through the ObjectDataProvider. If the data is present in comma-separated form, the data provider CsvDataProvider can be used. Many other data sources support the serialization to XML, so that the XmlDataProvider can be used. If only a small amount of additional information is to be passed, it is possible to do it directly. A sample is shown in Pass Additional Contents.

    The following overview lists the most important classes and their supported data sources.

     

    General Providers

    AdoDataProvider

    For the access to standardized ADO.NET objects the class AdoDataProvider is available and enables the access to data of the following elements:

    ListLabel LL = new ListLabel();
    
    AdoDataProvider provider = new AdoDataProvider(CreateDataSet());
    LL.DataSource = provider;
    
    LL.Print();
    
    LL.Dispose();
    
    Dim LL As New ListLabel()
    
    Dim provider As New AdoDataProvider(CreateDataSet())
    LL.DataSource = provider
    
    LL.Print()
    
    LL.Dispose()
    

    DataProviderCollection

    This data provider can be used to combine multiple other data providers into one data source. Use the provider DataProviderCollectionif you have e.g. multiple DataSet classes from where to pull data or if you would like to have a mix of XML and custom object data. In addition, it is also possible the different added data providers with the help of AddCrossProviderRelation into relation.

     

    DataSource

    This data provider is in an exceptional position because it can be inserted as a component directly from the Visual Studio toolbox. The DataSource component provides a few properties, which are also available through the SmartTags. The most important property is ConnectionProperties. By using the corresponding property editor, a connection string can be directly created in the development environment that provides access to following data sources:

    Once configured the data source is available in the selection window for the DataSource of the ListLabel component and can therefore be directly assigned. By clicking the link “Open report designer…” in the SmartTags of the ListLabel component the Designer can also be directly opened from within the development environment, requiring not a single line of code to access the data of a DataSource.

     

    ObjectDataProvider

    This makes it easy to access data/objects directly from the business layer of the application and to make this List & Label available as a data source. Which types of objects and a simple example can be found in detail in the ObjectDataProvider class.

     

    XmlDataProvider

    Allows accessing XML data files easily. No schema information in XML/XSD files will be used and no constraints will be handled. The main purpose of this class is to provide a fast and easy access to nested XML data.

    ListLabel LL = new ListLabel();
    
    XmlDataProvider provider = new XmlDataProvider(@"c:\users\public\data.xml");
    LL.DataSource = provider;
    
    LL.Design();
    LL.Dispose();
    
    Dim LL As New ListLabel()
    
    Dim provider As New XmlDataProvider("c:\users\public\data.xml")
    LL.DataSource = provider
    
    LL.Design()
    LL.Dispose()
    

     

    Provider for Databases

    DbCommandSetDataProvider

    Allows combination of multiple IDbCommand implementations into one data source. The provider DbCommandSetDataProvider can be used e.g. to access multiple SQL tables (see AddCommand) and define relations between them (see AddRelation). Another possibility is to combine data from e.g. SQL and Oracle databases into one data source.

     

    OleDbConnectionDataProvider

    The .NET Namespace System.Data provides the class OleDbConnection to access e.g. Microsoft Access database files. The provider OleDbConnectionDataProvider can connect directly to it and provide the data to List & Label.

     

    OracleConnectionDataProvider

    The data provider OracleConnectionDataProvider can be used to consume data from an Oracle database and it uses the ADO.NET providers Oracle.ManagedDataAccess.Client (not included).

     

    SqlConnectionDataProvider

    The .NET Namespace System.DataSqlClient provides the class SqlConnection to directly access Microsoft SQL Server databases. The provider SqlConnectionDataProvider can connect directly to it and provide the data List & Label. With the property SupportedElementTypes the data for List & Label can be restricted for further limitation e.g. only tables and/or views.

    However, if individual SQL statements are required as data sources, the provider DbCommandSetDataProvider is available for this purpose.

     

    Provider for Web Interfaces

    ODATADataProvider

    The ODataDataProvider provider can be used to access data provided as part of OData (Open Protocol Data).

     

    RestDataProvider

    The data returned by a REST query can be used with the RestDataProvider provider so that it can be used as a data source for List & Label.

     

    JsonDataProvider

    JSON objects are often used as a data exchange format between services. This data can also be made accessible via the provider JsonDataProvider to List & Label.

     

    More Dataprovider

    The data providers listed above only correspond to a small selection of already available data providers. In the namespace combit.Reporting.DataProviders all other dataproviders can be viewed. You can also use the IDataProvider interface to write a data provider for your own tailor-made data source.