How to access and bind object metadata (via JavaScript on the client), accessible from Upshot?

One of the perceived benefits of Upshot is its ability to request metadata opened through Data Annotations. How to access metadata for entity properties for things like string length, defaults, display name, description information, and is a field required?

How to connect this data with a validation framework, for example, with jQuery validation or knockout validation?

Note. I am currently using Knockout 2.1.0, Upshot 1.0.0.2, Entity Framework 4.3, and ASP.NET MVC4.

+3
source share
1 answer

upshot() , :

upshot:

@(Html.UpshotContext(bufferChanges: true)
    .DataSource<App.Controllers.DBController>(x => x.GetUsers())
    .ClientMapping<App.Models.User>("User")
)

( ) :

var metadata = upshot.metadata(upshot.type(User));

(, "" ):

var propertyType = upshot.metadata.getPropertyType(upshot.type(User), "Name");
0

All Articles