I'm trying to create a SPA using ASP.net MVC, datacontroller (not dbdatacontroller) and knockout. I do not wan't to use upshot before this becomes production.
I would very muc like to get all available metadata through a normal controller, so I can output this as Json, but I'm having a problem figuring out how. Here's an example:
public class Project
{
[Required(ErrorMessageResourceType=typeof(Localization.Projects.Project), ErrorMessageResourceName="Name_Required")]
[StringLength(50, ErrorMessageResourceType=typeof(Localization.Projects.Project), ErrorMessageResourceName="Name_StringLength")]
[Display("Name")]
public string Name { get; set; }
}
I should be able to call an uri, like: /getmetadata?project, which should return a json-string, like:
Gram_Phreak
Member
2 Points
4 Posts
MetaData to Json
Mar 28, 2012 04:47 PM|LINK
Hello,
I'm trying to create a SPA using ASP.net MVC, datacontroller (not dbdatacontroller) and knockout. I do not wan't to use upshot before this becomes production.
I would very muc like to get all available metadata through a normal controller, so I can output this as Json, but I'm having a problem figuring out how. Here's an example:
public class Project { [Required(ErrorMessageResourceType=typeof(Localization.Projects.Project), ErrorMessageResourceName="Name_Required")] [StringLength(50, ErrorMessageResourceType=typeof(Localization.Projects.Project), ErrorMessageResourceName="Name_StringLength")] [Display("Name")] public string Name { get; set; } }I should be able to call an uri, like: /getmetadata?project, which should return a json-string, like:
{ Project: { Name : { Display: "Name", Validations: { StringLength: {50, "Message"}, Required: {"Message"} } } }Is this possible in any way?
Best,
Morten