# Data Source Configuration Files

> Why Report Data Source Configuration files (.rdsc) work in Windows Forms only, and how WPF apps replace them with DataSets, relations and their own queries.

- **Product:** TX Text Control .NET for WPF
- **Section:** Documentation
- **Kind:** Topic
- **Path:** TX Text Control .NET for WPF > Mail Merge and Reporting > Data Sources > Data Source Configuration Files
- **918 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/mail-merge/data-sources/configuration-files/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/mail-merge/data-sources/configuration-files/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/mail-merge/data-sources/configuration-files/llms-full.txt

---

Report Data Source Configuration files, XML files with the extension *.rdsc*, store a database connection, a master table and the data relations between its tables, so that `MailMerge` can query a database by itself. They are a feature of Windows Forms applications: WPF applications can't create or use them. If you come across the file type in older samples or in the reference, what follows explains what it does, what stops it from working in WPF and how a WPF application reaches the same result.

### What a Configuration File Does

In a Windows Forms application, users connect a database in the Reporting tab, define relations between its tables and save these settings with **Config File** > **Save Configuration**. `MailMerge` then merges a template with the database in one call, reading the connection and the relations from the file. The Windows Forms documentation describes the whole workflow in [Data Source Configuration Files](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/mail-merge/data-sources/configuration-files/llms-full.txt).

### Why It Doesn't Work in WPF

The reference states that data source configuration files can only be used in Windows Forms applications. In WPF:

- [LoadDataSourceConfig](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-documentserver-datasources/datasourcemanager/loaddatasourceconfig-method/llms-full.txt) and [SaveDataSourceConfig](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-documentserver-datasources/datasourcemanager/savedatasourceconfig-method/llms-full.txt) of the `DataSourceManager` throw an exception when a WPF application calls them.
- The WPF [RibbonReportingTab](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-wpf/ribbonreportingtab/llms-full.txt) has no **Config File** button. Its **Select Data Source** drop-down offers **Load XML File**, **Load Assembly** and **Load JSON File**, but no command that connects a database.
- A configuration file can only be saved for a database connected through the `DatabaseConnectionDialog`, a Windows Forms dialog box that has no WPF counterpart.

The properties [ReportDataSourceConfigFile](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-documentserver/mailmerge/reportdatasourceconfigfile-property/llms-full.txt) and [ReportDataSourceConfig](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-documentserver/mailmerge/reportdatasourceconfig-property/llms-full.txt) of `MailMerge` are listed in the WPF reference because `MailMerge` is the same class in all TX Text Control .NET products. They are the Windows Forms route to configuration files and don't make the files usable in WPF.

### What to Do Instead in WPF

A configuration file combines three things, and a WPF application provides each of them in code:

| The file stores | In a WPF application |
|---|---|
| The connection to the database | Your code queries the database, for example with a `DataAdapter` or Entity Framework |
| The master table | The table or collection your code passes to the merge method |
| The data relations | `DataRelation` objects in the `DataSet`, or collections nested in business objects |

[Merge Related Tables](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/mail-merge/data-sources/datasets/#merge-related-tables) builds such a `DataSet` with an invoice and its items, adds the relation that a configuration file would have held and merges the master table into the template in the editor. In your application, fill the tables from the database instead of building them in memory.

To let users design templates for this data, load the same `DataSet` into the Reporting tab with [LoadDataSet](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-documentserver-datasources/datasourcemanager/loaddataset-method/llms-full.txt). Its relations appear in the tab like those of a configuration file, and users can add more with **Edit Data Relations**; keep your code's relations in line with them, because the designer's relations aren't saved.

When the data has to be read by another program or at another time, save it as JSON or XML instead of a configuration file: both formats carry the hierarchy with the data and are merged as [JSON and XML](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/mail-merge/data-sources/json-xml/llms-full.txt) describes.

### Next Steps

- [DataSets and DataTables](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/mail-merge/data-sources/datasets/llms-full.txt): relations, the Reporting tab and the relations dialog box.
- [JSON and XML](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/mail-merge/data-sources/json-xml/llms-full.txt): data files that users can load in the WPF Reporting tab.
- [Objects and Collections](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/mail-merge/data-sources/objects/llms-full.txt): data from a database as business objects.

---

## Nearby

- **Previous:** [JSON and XML](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/mail-merge/data-sources/json-xml/llms-full.txt)
- **Next:** [Merge Fields](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/mail-merge/fields/llms-full.txt)
