Skip to content

Instantly share code, notes, and snippets.

@mikebrind
Last active August 18, 2020 22:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikebrind/33396fd6550f2d735a66376f756056e4 to your computer and use it in GitHub Desktop.
Save mikebrind/33396fd6550f2d735a66376f756056e4 to your computer and use it in GitHub Desktop.
using Microsoft.Extensions.FileProviders;
using Microsoft.Extensions.Primitives;
using System;
using System.IO;
namespace RazorEngineViewOptionsFileProviders
{
public class DatabaseFileProvider : IFileProvider
{
private string _connection;
public DatabaseFileProvider(string connection)
{
_connection = connection;
}
public IDirectoryContents GetDirectoryContents(string subpath)
{
throw new NotImplementedException();
}
public IFileInfo GetFileInfo(string subpath)
{
var result = new DatabaseFileInfo(_connection, subpath);
return result.Exists ? result as IFileInfo : new NotFoundFileInfo(subpath);
}
public IChangeToken Watch(string filter)
{
return new DatabaseChangeToken(_connection, filter);
}
}
}
@feelil
Copy link

feelil commented Aug 18, 2020

Where is the "GetDirectoryContents" implementation ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment