Reflection Studio – Document Factory

This is a description of the document factory implemented into my codeplex project (

1 – An Open command is fired from the application (for exemple a double-click on a template file) with a file context “DiskContent”. This command is routed to the execute handler defined in the MainWindow

2 – Here, we call the DocumentFactory with the OpenDocument( DiskContent dc ) method. It will search in the supported document list if we can open a file based on his extension. We get in return a SupportedDocumentInfo structure that contains everything we need to open a document

3 – We create by reflection a new DataContext with the file name comming from the command. This will automatically create the file service needed to read/write the file

4 – We create by reflection the associated document user control by passing it the DataContext and SupportedDocInfo structures

All the rest of operation for load the document is done automatically by the framework. When the user control is loaded, it calls functions that goes through Datacontext, FileService.

Enjoy 🙂