Created
March 21, 2011 13:14
-
-
Save thecodejunkie/879433 to your computer and use it in GitHub Desktop.
Spike of players in Nancy view resolution using conventions
This file contains hidden or 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
| /* | |
| * Conventions are maintained as Func<string, NancyModule, string> delegates | |
| * Bootstrapper lets you register these in a IList<Func<string, NancyModule, string>> which then goes into the container | |
| * Take a dependency on IEnumerable<Func<string, NancyModule, string>> when you need access to the delegates | |
| */ | |
| public interface IViewFactory | |
| { | |
| Action<Stream> RenderView(NancyModule module, string viewName, dynamic model); | |
| } | |
| public interface IViewResolver | |
| { | |
| ViewLocationResult GetViewLocation(string viewName, NancyModule module); | |
| } | |
| public interface IViewLocator | |
| { | |
| /// <summary> | |
| /// | |
| /// </summary> | |
| /// <param name="viewName"></param> | |
| /// <param name="module"></param> | |
| /// <returns>A <see cref="ViewLocationResult"/> if a match could be made; otherwise <see langword="null"/>.</returns> | |
| /// <exception cref="AmbiguousViewsException">There were more that one <see cref="ViewLocationResult"/> that matched the provided <paramref name="viewName"/>.</exception> | |
| ViewLocationResult LocateView(string viewName, NancyModule module); | |
| } | |
| public interface IViewSourceProvider | |
| { | |
| /// <summary> | |
| /// Returns an <see cref="ViewLocationResult"/> instance for all the views that could be located by the provider. | |
| /// </summary> | |
| /// <param name="module"></param> | |
| /// <param name="supportedViewExtensions">An <see cref="IEnumerable{T}"/> instance, containing the view engine file extensions that is supported by the running instance of Nancy.</param> | |
| /// <returns>An <see cref="IEnumerable{T}"/> instance, containing <see cref="ViewLocationResult"/> instances for the located views.</returns> | |
| /// <remarks>If no views could be located, this method should return an empty enumerable, never <see langword="null"/>.</remarks> | |
| IEnumerable<ViewLocationResult> LocateViews(NancyModule module, IEnumerable<string> supportedViewExtensions); | |
| } | |
| public class AmbiguousViewsException : Exception | |
| { | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment