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
public interface INancyModule | |
{ | |
/// <summary> | |
/// Gets or sets an <see cref="ITemplateEngineSelector"/> which represents the current application context | |
/// </summary> | |
ITemplateEngineSelector TemplateEngineSelector { get; set; } | |
/// <summary> | |
/// Gets <see cref="RouteDictionary"/> for declaring actions for DELETE requests. | |
/// </summary> |
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
this is where I am at atm | |
Get["/test"] = x => { | |
return 1; | |
}; |
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
var asm = new FakeAssembly(x => { | |
x.AddResource("foo", "bar"); | |
x.AddResource("bar", "foo"); | |
}); | |
public class FakeAssembly : Assembly | |
{ | |
private readonly NameValueCollection resources = new NameValueCollection(); | |
public FakeAssembly() |
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
at TinyIoC.TinyIoCContainer.ResolveInternal(TypeRegistration registration, NamedParameterOverloads parameters, ResolveOptions options) in D:\My Dropbox\Development\Repositories\Nancy\src\Nancy\TinyIoc\TinyIoC.cs:line 2822 | |
at TinyIoC.TinyIoCContainer.<ResolveAllInternal>d__3b.MoveNext() in D:\My Dropbox\Development\Repositories\Nancy\src\Nancy\TinyIoc\TinyIoC.cs:line 3095 | |
at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext() | |
at TinyIoC.TinyIoCContainer.<ResolveAll>d__4`1.MoveNext() in D:\My Dropbox\Development\Repositories\Nancy\src\Nancy\TinyIoc\TinyIoC.cs:line 1857 | |
at System.Linq.SystemCore_EnumerableDebugView`1.get_Items() | |
at TinyIoC.TinyIoCContainer.ConstructType(Type type, ConstructorInfo constructor, NamedParameterOverloads parameters, ResolveOptions options) in D:\My Dropbox\Development\Repositories\Nancy\src\Nancy\TinyIoc\TinyIoC.cs:line 3032 | |
at TinyIoC.TinyIoCContainer.ConstructType(Type type, ConstructorInfo constructor, ResolveOptions options) in D:\My Dropbox\ |
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
namespace Nancy | |
{ | |
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using Nancy.ViewEngines; | |
using TinyIoC; | |
using Nancy.Bootstrapper; |
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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Dynamic; | |
using System.Text.RegularExpressions; | |
using System.Globalization; | |
using System.Collections.Specialized; | |
using System.Data; | |
using System.Configuration; |
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
public Action<Stream> RenderView<TModel>(ViewLocationResult viewLocationResult, TModel model) | |
{ | |
return stream => | |
{ | |
var templateManagerProvider = | |
new TemplateManagerProvider() | |
.WithLoader(new TemplateLoader(viewLocationResult.Contents)); | |
var templateManager = | |
templateManagerProvider.GetNewManager(); |
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
/// <summary> | |
/// This class provides a workaround for Unitys lack of support for <see cref="IEnumerable{T}"/> dependencies. No additional | |
/// functionality should be added to this type. | |
/// </summary> | |
public sealed class UnityViewFactory : DefaultViewFactory | |
{ | |
/// <summary> | |
/// The <see cref="Type"/> of the <see cref="UnityViewFactory"/> type. | |
/// </summary> | |
public static Type UnityViewFactoryType = typeof(UnityViewFactory); |
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
private ViewEngineResult RenderView<TModel>(string path, TModel model) | |
{ | |
var viewName = | |
Path.GetFileNameWithoutExtension(path); | |
var viewPath = | |
Path.GetDirectoryName(path); | |
var targetNamespace = string.Empty; //TODO Rob G: This can be used to support things like areas or features | |
this.ViewFolder = new FileSystemViewFolder(viewPath); |
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
static string GetResourceFileName(string resourceName) | |
{ | |
var nameSegments = | |
resourceName.Split(new[] { "." }, StringSplitOptions.RemoveEmptyEntries); | |
var segmentCount = | |
nameSegments.Count(); | |
return (segmentCount < 2) ? | |
string.Empty : |