本文介绍了如何大写首字母剃须刀的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是MVC的新手,尚未在线找到解决方案.
I am new to MVC and have not found a solution for this online.
我的html为:
@Html.DisplayFor(model => model.Address1) <br />我希望address1的所有首字母均为大写字母,例如一条路而不是一条路.
I want all the first letter of address1 to be capital letters e.g. Something Road instead of something road.
现在我有一个类客户端和属性Address1,并使用EF来获取地址,如下所示:
Now I have a class client and property Address1 and using EF to get the address as follow:
public class MyDBContext : DbContext { public DbSet<Client> Clients { get; set; } }希望这是有道理的.
推荐答案最好将表示层和数据访问层分开.创建一个包装或转换ORM/实体框架对象的视图模型.
It's best to keep the presentation layer and the data access layer separate. Create a view model that wraps or translates the ORM / entity framework objects.
public class ClientViewModel { private Client _dao; public ClientViewModel(Client dao) { _dao = dao; } public string Address { get { // modify the address as needed here return _dao.Address; } } }更多推荐
如何大写首字母剃须刀
发布评论