Created
February 28, 2017 12:48
-
-
Save darrenferguson/f613a42f86155bfefe832f2749b6d59a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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