R – How to specify a physical path on disc to a file, but acces a memory location

fileinputstreammemorynet

I'm trying to integrate several components to build a custom reporting solution. One of these components is a template-based report generator. It reads a template consisting on a RTF file with placeholders and perform the substitution. This works great, and generates an RTF report.

Although it can generate the results as a stream instead of a physical RTF file, it has a property meant to specify the full name for the template (input) file. This is Ok on desktop applications but when talking about a WCF Service I would like to avoid the need to have a physical file in the HD.

All the templates are stored inside a database. The application reads it from there as a stream and then saves it to the HD as an RTF file.
I'd like to know if it would be possible in c# to 'cheat' the report generator in such a way that I could specify a string consisting on a kind of 'virtual' or 'fictitious' path and then the componet would open the template from a memory stream as it was a real physical path on disc.

Any help will be appreciated.

Thanks in advance,

Gonzalo

Best Answer

Depending on how the reporting solution works, you may be able to use a named pipe. See this MSDN page for more information, but the basic gist is that you would call CreateNamedPipe and specify the name you want to use (in the format listed on that MSDN page), then pass that name as the file name to your reporting solution.