建议保持存储库的原样。建议你延长你的假期
Spotlight
Regex
属性或方法中的逻辑。
格式很好的描述。这样你就看不到逻辑了。
public partial class Spotlight
{
public string WellFormattedDescription()
{
//all the logic to return a well formatted Spotlight.Description
string desc = Regex.Replace(Regex.Replace(this.Description, "<[^>]*>",
string.Empty), "[\0x0020\r\n]+", " ")
.TrimEnd();
if (desc.Length < 297)
return desc;
else
return desc.Substring(0, 297) + "...";
}
}
然后,您的视图将调用:
<p>
<%=spotlight.WellFormattedDescription %>
<a href="<%= Url.Action("Details", "Spotlights", new { id=spotlight.SpotlightID}) %>">foo</a>
</p>