Created
August 5, 2015 13:59
-
-
Save jchannon/8c9dd82fb6a173fb002a to your computer and use it in GitHub Desktop.
RootpathProvider for Nancy when Hosting is separated
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 static class AssemblyExtensions | |
{ | |
public static string GetExecutionPath() | |
{ | |
var codeBase = Assembly.GetExecutingAssembly().CodeBase; | |
var uri = new Uri(codeBase); | |
var path = uri.LocalPath; | |
var root = Path.GetDirectoryName(path); | |
return root; | |
} | |
} |
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
protected override IRootPathProvider RootPathProvider | |
{ | |
get { return new MyRootPathProvider(); } | |
} |
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 VQRootPathProvider : IRootPathProvider | |
{ | |
public string GetRootPath() | |
{ | |
return AssemblyExtensions.GetExecutionPath(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment