Nancy model binding to child class

Viewed 3793

We are having an issue with Nancy's default model binder. Given the below...

public class Foo
{
    public Foo()
    {
    }

    public string Name { get; set; }

    public Bar Bar { get; set; }
}

public class Bar
{
    public string Name { get; set; }
}

with elements like...

<input type="text" value="Name" />
<input type="text" value="Bar.Name" />

With the default model binder used like so..

var foo = this.Bind<Foo>();

This correctly binds Foo.Name but fails to bind Foo.Bar.Name

Is there a way to enable this kind of binding with the default binder or do we need to roll our own? If so are there any good examples?

1 Answers
Related