You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 14, 2018. It is now read-only.
I'm in the process of updating a MVC website to .Net Core and run into this issue: #4842
Which is fine. I applied the fix to get the proper serialisation, but ran into an issue where passing a model to a page via @model. The property names are being camelCased even though I've told MVC to use the DefaultContractResolver.
Startup.cs:
services
.AddMvc()
.AddJsonOptions(options => options.SerializerSettings.ContractResolver = new DefaultContractResolver());
Model
public class Grade
{
public int Id { get; set; }
public string Description { get; set; }
}
Controller
public ActionResult EditGrade(int id)
{
var grade = _service.LoadGrade(id);
return View("GradeEdit", grade);
}
View
@model Grade
Browser
{id: 20, description: 'Test Data'}
The text was updated successfully, but these errors were encountered:
I'm in the process of updating a MVC website to .Net Core and run into this issue: #4842
Which is fine. I applied the fix to get the proper serialisation, but ran into an issue where passing a model to a page via @model. The property names are being camelCased even though I've told MVC to use the DefaultContractResolver.
Startup.cs:
Model
Controller
View
Browser
The text was updated successfully, but these errors were encountered: