One of the supposed benefits of Upshot is its ability to query meta-data exposed through Data Annotations. How would one access meta-data for entity properties for things like string length, default values, display name, description information, and whether a field is required?
How would connect this data into a validation framwork like 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.
You can use the upshot function metadata() to access this information, for example:
If you have the following upshot registration:
@(Html.UpshotContext(bufferChanges: true)
.DataSource<App.Controllers.DBController>(x => x.GetUsers())
.ClientMapping<App.Models.User>("User")
)
you can access the metadata (and validation rules) like this:
var metadata = upshot.metadata(upshot.type(User));
you can also retrieve information about properties (eg. "Name"):
var propertyType = upshot.metadata.getPropertyType(upshot.type(User), "Name");