开发者

Simple string templating in ASP.NET MVC

开发者 https://www.devze.com 2023-02-06 03:20 出处:网络
I have a bunch of database log messages containing references like Invoice 45 or Cas开发者_StackOverflow中文版e 123 which I want to parse to output links to the appropriate invoice or case when displa

I have a bunch of database log messages containing references like Invoice 45 or Cas开发者_StackOverflow中文版e 123 which I want to parse to output links to the appropriate invoice or case when displaying to the user.

These are fairly simple to parse with RegEx and replace with an action link using an ASCX display template, but is there a right way to do this? I imagine this means writing a parser to tokenise the string and prevent any potential circular references.


An HTML helper is probably a better fit - the parsing / display doesn't do anything that you could put in the ascx that isn't better handled in code.

0

精彩评论

暂无评论...
验证码 换一张
取 消