With the following files in bin:
- ScriptCs.FooPack.dll
- ScriptCs.Contracts.dll
Yields the following output:
INFO : Starting to create execution components
INFO : Starting execution
Hello from Foo!
INFO : Finished execution
<ScrollViewer Style="{StaticResource AppHost_ScrollViewer}"> | |
<Interactivity:Interaction.Behaviors> | |
<custom:ScrollViewerMaxSizeBehavior MinContentWidth="600" | |
MinContentHeight="500"/> | |
</Interactivity:Interaction.Behaviors> | |
<!-- content --> | |
</ScrollViewer> |
public class DecimalModelBinder : IModelBinder | |
{ | |
public object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext) | |
{ | |
var valueResult = bindingContext.ValueProvider.GetValue(bindingContext.ModelName); | |
var modelState = new ModelState { Value = valueResult }; | |
object actualValue = null; | |
if (string.IsNullOrEmpty(valueResult.AttemptedValue)) |
// --- First example | |
public class MyApplication : Application | |
{ | |
private readonly Window _mainWindow; | |
public MyApplication(Window mainWindow) | |
{ | |
_mainWindow = mainWindow; | |
} |
module.exports = function (grunt) { | |
grunt.loadNpmTasks('grunt-contrib-concat'); | |
grunt.loadNpmTasks('grunt-contrib-jshint'); | |
grunt.loadNpmTasks('grunt-contrib-uglify'); | |
grunt.loadNpmTasks('grunt-contrib-clean'); | |
grunt.loadNpmTasks('grunt-contrib-copy'); | |
grunt.loadNpmTasks('grunt-contrib-watch'); | |
grunt.loadNpmTasks('grunt-recess'); | |
grunt.loadNpmTasks('grunt-testacular'); |
With the following files in bin:
Yields the following output:
INFO : Starting to create execution components
INFO : Starting execution
Hello from Foo!
INFO : Finished execution
if (!pipelines.AfterRequest.PipelineItems.Any(x => x.Name.Equals(SaveAndDisposeItemName))) | |
{ | |
pipelines.AfterRequest.AddItemToEndOfPipeline( | |
new PipelineItem<Action<NancyContext>>( | |
SaveAndDisposeItemName, | |
ctx => DisposeSession(container))); | |
} |
public class Bootstrapper : DefaultNancyBootstrapper | |
{ | |
protected override void RequestStartup(TinyIoCContainer container, IPipelines pipelines, NancyContext context) | |
{ | |
pipelines.OnError.AddItemToEndOfPipeline((ctx, ex) => | |
{ | |
var exception = ex.GetRootException(); | |
return ctx.Negotiate().WithModel(new Error | |
{ |
public static class NegotiateExtensions | |
{ | |
public static Negotiator WithCrazyModel(this Negotiator negotiator, object model) | |
{ | |
return negotiator | |
.WithMediaRangeModel(MediaRange.FromString("application/foo"), new FooWrapper(model)) | |
.WithMediaRangeModel(MediaRange.FromString("application/bar"), new BarWrapper(model)); | |
} | |
} |
using System.Text.RegularExpressions; | |
private const string DelimiterRegex = @"\[(.*?)\]"; | |
public int Add(string numbers) | |
{ | |
if (string.IsNullOrEmpty(numbers)) return 0; | |
var delimiters = new List<string> { "," }; |
protected override void RequestStartup(ILifetimeScope container, IPipelines pipelines, NancyContext context) | |
{ | |
pipelines.AfterRequest.AddItemToEndOfPipeline(ctx => | |
{ | |
if (ctx.Response.StatusCode != HttpStatusCode.InternalServerError) | |
{ | |
container.Resolve<DbContext>().SaveChanges(); | |
} | |
}); | |
} |