Changing Field Name Value in ViewModel
Is there any way to change the FieldName Value for a property in a Viewmodel? I would like to use the standard naming convention for the property, but have the viewmodel return something else. This is important, because I have a json request that requires the properties to be in lowercase.
I have tried using both XMLAttributes, and DataMembers, but neither of those soultions worked. Those came from the following questions.
Serialize .Net object to json, controlled using xml attributes
JavaScriptSerializer.Deserialize - how to change field names
So, to reit开发者_StackOverflowerate, I need something like this
public string Start { get; set; }
to show up as
viewmodel.start
instead of
viewmodel.Start
when I am passing my viewmodel to the callback inside the getJson request
What about adding an extra property to your model?
public string start {get {return Start;}}
精彩评论