Skip to content

Instantly share code, notes, and snippets.

@darrenferguson
Created February 28, 2017 12:48
Show Gist options
  • Save darrenferguson/f613a42f86155bfefe832f2749b6d59a to your computer and use it in GitHub Desktop.
Save darrenferguson/f613a42f86155bfefe832f2749b6d59a to your computer and use it in GitHub Desktop.
public class ArchiveContentFinder : IContentFinder
{
public bool TryFindContent(PublishedContentRequest contentRequest)
{
var path = contentRequest.Uri.GetAbsolutePathDecoded();
var db = ApplicationContext.Current.DatabaseContext.Database;
var archived = db.SingleOrDefault<Archive>("select * from archive where Url = @0 or Url = @1", path, path + "/");
if(archived != null)
{
var content = new MyPublishedContent(archived.Xml);
contentRequest.PublishedContent = content;
return true;
}
return false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment