如何大写首字母剃须刀

编程入门 行业动态 更新时间:2024-10-27 11:23:55
本文介绍了如何大写首字母剃须刀的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我是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; } } }

更多推荐

如何大写首字母剃须刀

本文发布于:2023-10-23 19:36:37,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1521817.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:剃须刀   首字母

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!