示例#1
0
        public virtual void Write(ICodeFragment fragment, IOutputCache output)
        {
            if (fragment == null)
            {
                return;
            }
            this.lastFragments.Insert(0, fragment);
            while (this.lastFragments.Count > 10)
            {
                this.lastFragments.RemoveAt(this.lastFragments.Count - 1);
            }
            if (fragment is ChainedCodeFragment chainedCodeFragment && !this.IsProcessed(chainedCodeFragment))
            {
                this.WriteChained(chainedCodeFragment, output);
                return;
            }
            Type key = fragment.GetType();

            if (this.TemplateWriters.ContainsKey(key))
            {
                this.TemplateWriters[key].Write(fragment, output);
            }
            else
            {
                throw new NotImplementedException($"The method {nameof(Write)} for type {key.Name} is not implemented in {this.Name}.");
            }
        }
 public override void Write(ICodeFragment fragment, IOutputCache output)
 {
     if (fragment is CommentTemplate)
     {
         new CommentWriter().Write(fragment, output);
     }
     else
     {
         throw new NotImplementedException($"The method {nameof(Write)} for type {fragment.GetType().Name} is not implemented in {this.Name}.");
     }
 }
示例#3
0
 public virtual void Write(ICodeFragment code, IOutputCache output)
 {
     throw new NotImplementedException($"The method {nameof(Write)} for type {code.GetType().Name} is not implemented in {this.Name}.");
 }