简体   繁体   English

在MVC网站中加载文本的最佳做法是什么?

[英]What is best practice to load text in an MVC website?

Can somebody suggest what is the best practice to load text(which has 2-5 paragraphs) in razor page, either by getting text load from word document(write ac# class to parse word document and through controller pass the data to view) or directly embedding the text in the Razor page ? 有人可以建议通过在Word文档中加载文本(编写ac#类以解析Word文档并通过控制器将数据传递给视图)来在剃刀页面中加载文本(具有2-5个段落)的最佳做法是什么,或者直接在Razor页面中嵌入文本?

Thanks 谢谢

If you don't expect the text to change then just write it in your Razor view. 如果您不希望文本更改,则只需在Razor视图中编写即可。

If the text might change, and you don't want to re-publish every time, then you can have the controller read it from a file or database and pass it to the Razor view. 如果文本可能更改,并且您不想每次都重新发布,则可以让控制器从文件或数据库中读取文本并将其传递到Razor视图。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 MVC 4项目中基本模型的最佳实践是什么? - What is the best practice for base model in MVC 4 project? 处理MVC Post模型的最佳实践是什么? - What Is The Best Practice To Deal With MVC Post Models? 用纯文本解析占位符的最佳实践是什么? - What is the best practice to resolve placeholders in a plain text? MVC服务的最佳实践 - Best Practice for Services with MVC mvc2确认密码字段的最佳做法是什么? - What is the best practice for mvc2 confirm password field? 在MVC中以简单的层次结构构建模型,最佳实践是什么? - Structuring models in a simple hierarchy in MVC, what's the best practice? 在asp.net mvc中返回错误的最佳做法是什么? - what is the best practice for returning a error in asp.net mvc 在Asp.Net MVC 5中实现多个数据库的最佳实践是什么? - What is the best practice for implementing multiple databases in Asp.Net MVC 5? MVC验证 - 使用服务层保持干燥 - 最佳做法是什么? - MVC Validation - Keep it DRY with a service layer - What is best practice? 在MVC 4应用程序中使用Unity with Entity Framework的最佳实践是什么 - What is best practice for using Unity with Entity Framework in a MVC 4 application
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM