我在vs2013中写了一个mvc5项目
控制器中的方法返回json
public override System.Web.Security.MembershipUser GetUser(string username, bool userIsOnline)
{
System.Web.Security.MembershipUser user = db.Users.Where(u => u.Name == username).FirstOrDefault();
return user;
}
模型是
public JsonResult QueryConcens(ConcentratorView concenForQuery)
{
QueryConcentratorsRequest request = new QueryConcentratorsRequest() { ConcenQuery = concenForQuery };
return
Json
(
concenstratorService
.QueryConcentrators(request)
.ConcensView
);
}
它返回:
public class ConcentratorView
{
[Required(ErrorMessage="please input id")]
public string ConcentratorID { get; set; }
public string Name { get; set; }
public string Address { get; set; }
}
我希望地址:null为""
然后我添加
[{"ConcentratorID":"43","Name":"345","Address":"345"},
{"ConcentratorID":"56","Name":"","Address":null},
{"ConcentratorID":"concen_123","Name":"wer","Address":null}]
但它返回
[DisplayFormat(ConvertEmptyStringToNull = false)]
public string Address { get; set; }
它丢失了两行
为什么?