The DataSourceManager class is designed for handling all existing kinds of data sources which can be used together with the MailMerge class. Use this class to determine which data tables, column names and data relations a data source contains and to insert merge block templates into documents.

Syntax

public class DataSourceManager
Public Class DataSourceManager

Introduced: X14.

Constructors

Constructor Description
DataSourceManager Initializes a new instance of the DataSourceManager class.

Events

Event Description
ConnectionStringChanged Is fired when the contents of the ConnectionString property change.
DataProviderNameChanged Is fired when the contents of the DataProviderName property change.
DataRelationsChanged Is fired when the contents of the DataRelations property change.
DataRowMerged Occurs when a data row has been merged successfully.
DataTablesChanged Is fired when the contents of the DataTables property change.
FieldMerged Occurs when a field has been merged.
IsMergingPossibleChanged Is fired when the value of the IsMergingPossible property changes.
MasterDataTableInfoChanged Is fired when the contents of the MasterDataTableInfo property change.
PossibleMergeBlockTablesChanged Is fired when the contents of the PossibleMergeBlockTables property change.
PossibleMergeFieldColumnsChanged Is fired when the contents of the PossibleMergeFieldColumns property change.

Methods

Method Description
InsertMergeBlock Inserts a repeating merge block into a TextControl instance, a WPF.TextControl instance or a ServerTextControl instance at the current input position.
IsMergeBlock Checks if a given SubTextPart is a merge block.
LoadAssembly Loads an assembly file as a data source.
LoadDataSet Loads a System.Data.DataSet object as a data source.
LoadDataSourceConfig Loads an XML string or a file containing "report data source configuration" data.
LoadDataTable Loads a System.Data.DataTable object as a data source.
LoadJson Loads a JSON string containing an array of objects or a single object as a data source.
LoadObjects Loads a collection implementing the interface IEnumerable as a data source and deduces the data tables, column names and data relations from the public properties and used classes of the first contained object using .NET reflection or, in case of the first contained object being a Dictionary with string keys, from the key names and value types.
LoadSingleObject Loads a single object which is either a Dictionary with string keys or an object of an arbitrary type as a data source.
LoadXmlFile Loads the contents of an XML file as a data source.
LoadXmlString Loads XML data, given as a string, as a data source.
Merge Merges a binary TX internal unicode format document with the currently loaded data source.
SaveDataSourceConfig Saves an XML string or a file containing "report data source config" data.

Properties

Property Description
ConnectionString Gets the connection string of the connection selected with the DatabaseConnectionDialog.
DataProviderName Gets the name of the data provider selected with the DatabaseConnectionDialog.
DataRelations Gets a DataRelationInfoCollection of DataRelationInfo objects which represent the data relations in the data source.
DataSourceCulture Specifies the culture with which numerical and date / time values coming from the data source are parsed.
DataTables Gets a DataTableInfoCollection of DataTableInfo objects which represent the data tables in the data source.
IsMergingPossible Gets a value indicating whether all requirements are met and the method Merge can be called.
MasterDataTableInfo Gets or sets a DataTableInfo object representing the table which is used as a master table when merging data into the document.
MaxMergeResults Specifies the Upper merge result count.
MergeCulture Specifies the culture with which numerical and date / time values are formatted when merged into the target document.
PossibleMergeBlockTables Gets a DataTableInfoCollection of DataTableInfo objects representing the tables which can be used as merge blocks using the currently selected master table.
PossibleMergeFieldColumns Gets a DataColumnInfoCollection of DataColumnInfo objects representing the table columns which can be used as merge fields using the currently selected master table.

Further Reading

Learn more about the TXTextControl.DocumentServer.DataSources.DataSourceManager Class in the Text Control Blog: