ASP.net MVC:从数据库字符串执行 Razor?
我正在考虑让最终用户能够将部分视图(控件)放入数据库中存储的信息中。有没有办法执行我从数据库获取的字符串作为 Razor 视图的一部分?
I was thinking about giving end users the ability to drop Partial Views (controls) into the information being stored in the database. Is there a way to execute a string I get from the database as part of the Razor view?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
更新(我忘记了这一切)
我之前问过这个问题(这导致我创建 RazorEngine)从数据库而不是文件中提取视图
我知道至少有两个: RazorEngine,MvcMailer
我对 RazorEngine 有偏见,因为它我已经开发过一个,但我在 Github 上有一个更简单的,名为 RazorSharp(虽然它只支持c#)
这些都非常容易使用。
RazorEngine:
MvcMailer
我没有使用过这个,所以我无法提供帮助。
RazorSharp
RazorSharp 还支持母版页。
RazorSharp 和 RazorEngine 都不支持任何 Mvc 帮助程序,例如
Html
和Url
。由于这些库应该存在于 Mvc 之外,因此需要更多的工作才能让它们与这些助手一起工作。我不能对 MvcMailer 说什么,但我怀疑情况是一样的。希望这些有帮助。
Update (I forgot all about this)
I had asked this question previously (which lead me to create RazorEngine) Pulling a View from a database rather than a file
I know of at least two: RazorEngine, MvcMailer
I have a bias towards RazorEngine as it's one that I've worked on but I have a much simpler one at Github called RazorSharp (though it only supports c#)
These are all pretty easy to use.
RazorEngine:
MvcMailer
I haven't used this one so I can't help.
RazorSharp
RazorSharp also supports master pages.
Neither RazorSharp, nor RazorEngine support any of the Mvc helpers such as
Html
andUrl
. Since these libraries are supposed to exist outside of Mvc and thus require more work to get them to work with those helpers. I can't say anything about MvcMailer but I suspect the situation is the same.Hope these help.