public override void Write(TextWriter writer, Context context) { var value = context.GetValue(_expression); if (value.IsNullOrNoValue()) { return; } writer.Write(Convert.ToString(value)); }
public void CheckValueCaching() { const string name = "abc"; var root = new Item(name); var context = new Context(root); for (int i = 0; i < 2; i++) { Assert.AreEqual(name, context.GetValue("Name")); Assert.AreEqual(1, root.NameCalls); } }
public override void Write(TextWriter writer, Context context) { if (context.GetValue(_expression).IsFalse()) { _content.Write(writer, context); } else { _else.Write(writer, context); } }
public override void Write(TextWriter writer, Context context) { var value = context.GetValue(_expression); if (value.IsNullOrNoValue()) return; try { context.Push(value, null); _content.Write(writer, context); } catch (Exception) { context.Pop(); } }
public override void Write(TextWriter writer, Context context) { var value = context.GetValue(_expression); if (value.IsNullOrNoValue()) { return; } try { context.Push(value, null); _content.Write(writer, context); } catch (Exception) { context.Pop(); } }
public override void Write(TextWriter writer, Context context) { var value = context.GetValue(_expression); if (value.IsNullOrNoValue()) return; writer.Write(Convert.ToString(value)); }