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
namespace NancyEmbeddedTest | |
{ | |
using System; | |
using System.Collections.Generic; | |
using System.Reflection; | |
using Nancy; | |
using Nancy.Bootstrapper; | |
using Nancy.ViewEngines; | |
public class Modules : NancyModule |
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 ResponseResponseProcessor : IResponseProcessor | |
{ | |
public IEnumerable<Tuple<string, MediaRange>> ExtensionMappings | |
{ | |
get | |
{ | |
return Enumerable.Empty<Tuple<string, MediaRange>>(); | |
} | |
} |
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
/// <summary> | |
/// A validation error. | |
/// </summary> | |
public class ModelValidationError | |
{ | |
private readonly Func<IEnumerable<string>, string> errorMessageFormatter; | |
/// <summary> | |
/// Initializes a new instance of the <see cref="ModelValidationError"/> class. | |
/// </summary> |
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
{ | |
"ModelType":"Nancy.Demo.Validation.Models.Product", | |
"Rules":{ | |
"Name":[ | |
{ | |
"MemberNames":[ | |
"Name" | |
], | |
"RuleType":"NotEmpty" | |
}, |
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
var existingCustomer = session.Query<Customer>() | |
.FetchMany(c => c.DeliveryAddresses) | |
.SingleOrDefault(c => c.CustomerId.Equals(imported.CustomerId)); |
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
var existingCustomer = session.Query<Customer>() | |
.FetchMany(c => c.Users) | |
.FetchMany(c => c.DeliveryAddresses) | |
.AsEnumerable() | |
.SingleOrDefault(c => c.CustomerId.Equals(importedCustomer.CustomerId)); |
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
var encoding = | |
new UTF8Encoding(false); | |
File.WriteAllText(Path.Combine(outputFolder, SourceFile), result.Body.AsString(), encoding); |
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
/// <summary> | |
/// Contains extension methods for the <see cref="Expression"/> type. | |
/// </summary> | |
public static class ExpressionExtensions | |
{ | |
/// <summary> | |
/// Retrieves the member that an expression is defined for. | |
/// </summary> | |
/// <param name="expression">The expression to retreive the member from.</param> | |
/// <returns>A <see cref="MemberInfo"/> instance if the member could be found; otherwise <see langword="null"/>.</returns> |
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
var page = require('webpage').create(); | |
var system = require('system'); | |
var address; | |
address = system.args[1]; | |
console.log(address); | |
page.open(address, function(status) { | |
console.log(status); |
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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using Nancy.ModelBinding; | |
public class DynamicModelBinder : IModelBinder | |
{ | |
public object Bind(NancyContext context, Type modelType, object instance, BindingConfig configuration, params string[] blackList) | |
{ | |
var data = |