Sample VirtualPathProvider that uses a DB/NoSql

I searched but didn’t find much. Does anyone have a sample VirtualPathProvider that is hitting a database (sql, nosql/etc). Just looking for a sample to reference.

There’s only FileSystem, Memory, Embedded Resources or S3 Virtual Path Providers.

I saw those implementations just curious if anyone else has implemented any with a database backing store. All I’m really trying to do is pull a string from the database that contains razor markup. I could write it to the file system which might be easier than building an entire Virtual Path Provider.

RazorFormat has no render string’s only files except for CreateAndRenderToHtml which takes a string but doesn’t seem to work.

You might as well write it to a Memory VFS

I will take a look. I guess I’d have to write it if it doesn’t exist and then remove it later…

Well it’s in Memory, you could just populate it from the DB when the AppHost starts up, then forget about it. It goes away when the AppDomain recycles like any other In Memory collection.

Too much data and changes frequently… It has to be on the fly which may not work as the RazorFormat.VirtualFileSources implements IVirtualPathProvider so I can’t write files with it… :frowning:

I’ll try to cast it to the inmemory one and write to it on the fly.

I switched it out for the in memory provider, am populating it and the get view doesn’t return a view. I’m going to post in SO.