# Create Database Excerpt Files from Assemblies

> The AssemblySerializer class creates database excerpt XML files from .NET assemblies by reading public classes and members via reflection. These XSD files populate merge field and merge block drop-downs in TX Text Control template designers, enabling templates built on business objects.

- **Author:** Bjoern Meyer
- **Published:** 2015-08-25
- **Modified:** 2026-07-17
- **Description:** The AssemblySerializer class creates database excerpt XML files from .NET assemblies by reading public classes and members via reflection. These XSD files populate merge field and merge block drop-downs in TX Text Control template designers, enabling templates built on business objects.
- **4 min read** (640 words)
- **Tags:**
  - GitHub
  - HTML5
  - Reporting
- **Web URL:** https://www.textcontrol.com/blog/2015/08/25/create-database-excerpt-files-from-assemblies/
- **LLMs URL:** https://www.textcontrol.com/blog/2015/08/25/create-database-excerpt-files-from-assemblies/llms.txt
- **LLMs-Full URL:** https://www.textcontrol.com/blog/2015/08/25/create-database-excerpt-files-from-assemblies/llms-full.txt
- **GitHub Repository:** https://github.com/TextControl/TextControl.MailMerge.DocumentServer.AssemblySerializer

---

The engine [MailMerge](https://docs.textcontrol.com/textcontrol/windows-forms/ref.txtextcontrol.documentserver.mailmerge.class.htm) interprets all public properties of objects in an **IEnumerable** collection as table columns and child tables. Properties of type **IEnumerable** are automatically instantiated as relations and are used for merge blocks and nested merge blocks.

The Text Control Reporting template designers for Windows Forms, WPF and ASP.NET provide the functionality to load XML excerpt files. The drop-down buttons *Select Master Table*, *Insert Merge Field* and *Insert Merge Block* are pre-filled with items of a specific *Database Excerpt* XML file that can be loaded programmatically.

![Create database excerpt files from assemblies](https://s1-www.textcontrol.com/assets/dist/blog/2015/08/25/a/assets/n_aspnet_new_html5_mailingstab.webp "Create database excerpt files from assemblies")This XML database file contains table definitions, relations and optionally row excerpts to provide a preview of the report.

We just published the class *AssemblySerializer* that creates such XML XSD files from a given assembly. All public classes and the public members are exported with the proper name and return type. This way, you can create the templates with the merge fields and blocks from your own business objects encapsulated in an assembly.

The usage is very easy. The class *AssemblySerializer* has the static method *Serialize* that accepts an assembly path and returns the database excerpt as an XML string.

```
string sSerializedAssembly =
  AssemblySerializer.Serialize(tbAssemblyPath.Text);
```

The [GitHub repository](https://github.com/TextControl/TextControl.MailMerge.DocumentServer.AssemblySerializer) comes with 3 projects:

| **DocumentServer.AssemblySerializer** | The class AssemblySerializer itself. |
|---|---|
| **TestProject** | A Windows Forms test project to select an assembly and to visualize the XML file. |
| **myDummyClass** | A dummy project with two classes and different member types to test the serializer. |

In order to test this class, follow these easy steps.

1. Download the [GitHub repository](https://github.com/TextControl/TextControl.MailMerge.DocumentServer.AssemblySerializer/archive/master.zip) and open the project *TestProject - > TestProject.sln*.
2. Compile and start the project.
3. Click on *Serialize* to serialize the sample assembly *myDummyClass.dll*.
    
    ![Serialize the assembly](https://s1-www.textcontrol.com/assets/dist/blog/2015/08/25/a/assets/assembly_serialize.webp "Serialize the assembly")
4. Click on *Save XML*, choose a file name and location and confirm with *Save*.
5. Open the template designer *TX Text Control Words*. The designers are located in the start menu in the created folder for your TX Text Control installation.
    
    ![Start menu](https://s1-www.textcontrol.com/assets/dist/blog/2015/08/25/a/assets/start_menu_txwords.webp "Start menu")
6. In the ribbon tab *Mailings*, click on *Load XML File* from the *Data Source* drop-down button.
    
    ![Load XML](https://s1-www.textcontrol.com/assets/dist/blog/2015/08/25/a/assets/load_xml.webp "Load XML")
7. Browse for the XML file that has been saved in step 4 and confirm with *Open*.

The drop-down buttons *Select Master Table*, *Insert Merge Field* and *Insert Merge Block* are now pre-filled with items from the serialized assembly. All classes are listed as tables and public members are listed as merge fields. If a class contains a reference to another class in the assembly, a data relation is created and listed in the *Edit Data Relations* button.

XSD and 'xml-msdata': Background Information
--------------------------------------------

The class *AssemblySerializer* reads an assembly and creates an XML document that contains the schema information. It uses the schema for the XSD annotations added by the DataSet class (*urn:schemas-microsoft-com:xml-msdata*). The DataSet class has a function called *WriteXmlSchema*, which creates the XML schema file. The same schema is used for these excerpt files. The Windows SDK also provides a tool called [XSD.exe](https://msdn.microsoft.com/en-us/library/x6c1kb0s%28v=vs.110%29.aspx) that creates those files, but the relations are missing and the application cannot be deployed.

Therefore, the *AssemblySerializer* creates the complete XML file programmatically.

Download the sample from GitHub and test it on your own.

---

## About Bjoern Meyer

As CEO, Bjoern is the visionary behind our strategic direction and business development, bridging the gap between our customers and engineering teams. His deep passion for coding and web technologies drives the creation of innovative products. If you're at a tech conference, be sure to stop by our booth - you'll most likely meet Bjoern in person. With an advanced graduate degree (Dipl. Inf.) in Computer Science, specializing in AI, from the University of Bremen, Bjoern brings significant expertise to his role. In his spare time, Bjoern enjoys running, paragliding, mountain biking, and playing the piano.

- [LinkedIn](https://www.linkedin.com/in/bjoernmeyer/)
- [X](https://x.com/txbjoern)
- [GitHub](https://github.com/bjoerntx)

---

## Related Posts

- [Updated MVC Sample: Loading Files from the Backstage Menu](https://www.textcontrol.com/blog/2017/04/20/updated-mvc-sample-loading-files-from-the-backstage-menu/llms.txt)
- [ASP.NET MVC: Implementing a Simplistic, Custom Button Bar](https://www.textcontrol.com/blog/2017/03/13/aspnet-mvc-implementing-a-simplistic-custom-button-bar/llms.txt)
- [ASP.NET MVC: Adding Protected Sections to Documents](https://www.textcontrol.com/blog/2017/03/01/aspnet-mvc-adding-protected-sections-to-documents/llms.txt)
- [ASP.NET: Adding Electronic Signatures to Documents](https://www.textcontrol.com/blog/2016/10/12/aspnet-adding-electronic-signatures-to-documents/llms.txt)
- [HTML5: Display and Handle FormCheckBox Fields](https://www.textcontrol.com/blog/2015/09/22/html5-display-and-handle-formcheckbox-fields/llms.txt)
- [Creating Your First ASP.NET Reporting Application](https://www.textcontrol.com/blog/2020/01/01/creating-your-first-aspnet-reporting-application/llms.txt)
- [Automatically Reconnect to the Server and Recover the Document](https://www.textcontrol.com/blog/2019/09/05/automatically-reconnect-to-the-server-and-recover-the-document/llms.txt)
- [ReportingCloud: Open Source Documentation Released](https://www.textcontrol.com/blog/2019/02/11/open-source-documentation-released/llms.txt)
- [JavaScript API: Working with Merge Fields](https://www.textcontrol.com/blog/2018/03/05/javascript-api-working-with-merge-fields/llms.txt)
- [Technology Preview: Embeddable HTML Widget to integrate Document Editing to Angular, React and other Frameworks](https://www.textcontrol.com/blog/2018/03/01/embeddable-html-widget-for-all-frameworks/llms.txt)
- [Embedding TXTextControl.Web in non-.NET Framework applications like .NET Core and AngularJS](https://www.textcontrol.com/blog/2017/10/23/embedding-txtextcontrol/llms.txt)
- [Sneak Peek X15: Custom Field Overlays in HTML5-based Text Control](https://www.textcontrol.com/blog/2017/06/21/sneak-peek-x15-custom-field-overlays-in-html5-based-text-control/llms.txt)
- [New ASP.NET MVC DocumentViewer Rolled out to the ReportingCloud Portal](https://www.textcontrol.com/blog/2017/04/22/new-aspnet-mvc-documentviewer-rolled-out-to-the-reportingcloud-portal/llms.txt)
- [Creating Dynamic HTML Forms Using ReportingCloud](https://www.textcontrol.com/blog/2016/09/28/creating-dynamic-html-forms-using-reportingcloud/llms.txt)
- [MVC: Loading a Document in the View Code from a MemoryStream](https://www.textcontrol.com/blog/2016/03/16/mvc-loading-a-document-in-the-view-code-from-a-memorystream/llms.txt)
- [MVC: Adding an Electronic Signature to Documents in Web.TextControl](https://www.textcontrol.com/blog/2016/02/18/mvc-adding-an-electronic-signature-to-documents-in-webtextcontrol/llms.txt)
- [MVC: Loading a Data Source from a View Model](https://www.textcontrol.com/blog/2016/01/29/mvc-loading-a-data-source-from-a-view-model/llms.txt)
- [MVC: Merging Templates in a Controller HttpPost Method](https://www.textcontrol.com/blog/2016/01/19/mvc-merging-templates-in-a-controller-httppost-method/llms.txt)
- [MVC: Loading Files from the Backstage Menu](https://www.textcontrol.com/blog/2016/01/06/mvc-loading-files-from-the-backstage-menu/llms.txt)
- [MVC: Replace the File Menu with a Backstage View Menu](https://www.textcontrol.com/blog/2015/12/30/mvc-replace-the-file-menu-with-a-backstage-view-menu/llms.txt)
- [MVC: Replace the Ribbon Table Menu with a Quick Insert Table Drop-down](https://www.textcontrol.com/blog/2015/12/23/mvc-replace-the-ribbon-table-menu-with-a-quick-insert-table-drop-down/llms.txt)
- [MVC: Arrange a Docked Web.TextControl with a Custom Bar at the Top](https://www.textcontrol.com/blog/2015/12/18/mvc-arrange-a-docked-webtextcontrol-with-a-custom-bar-at-the-top/llms.txt)
- [Setting the Interface and Control's Culture of Web.TextControl](https://www.textcontrol.com/blog/2015/12/16/setting-the-interface-and-controls-culture-of-webtextcontrol/llms.txt)
- [MVC: Autosave and Restore Documents to and from the Local Browser Storage](https://www.textcontrol.com/blog/2015/12/14/mvc-autosave-and-restore-documents-to-and-from-the-local-browser-storage/llms.txt)
- [MVC: Loading and Saving Documents Through Controller HttpPost Methods](https://www.textcontrol.com/blog/2015/12/08/mvc-loading-and-saving-documents-through-controller-httppost-methods/llms.txt)
