Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET MVC (4) - Bind properties in a certain order

Is there a way to force binding of properties A and B before C?

There's Order property in the System.ComponentModel.DataAnnotations.DisplayAttribute class, but does it affect binding order?

What i'm trying to achieve is

page.Path = page.Parent.Path + "/" + page.Slug

in a custom ModelBinder

like image 462
Mike Koder Avatar asked Nov 13 '22 06:11

Mike Koder


1 Answers

Why not implement the Page property as:

public string Path{
    get { return string.Format("{0}/{1}", Parent.Path, Slug); }
}

?

like image 52
Sam Avatar answered Dec 17 '22 01:12

Sam