예제 #1
0
        public override void GenerateCode(Span target, CodeGeneratorContext context)
        {
            // Build the string
            string code = Prefix + target.Content + ";";

            // Calculate the line pragma including information about where the user-specified code starts and ends (for editors)
            CodeLinePragma pragma = context.GenerateLinePragma(target, Prefix.Length, target.Content.Length);

            // Add the statement
            context.AddStatement(code, pragma);
        }
예제 #2
0
        public override void GenerateCode(Span target, CodeGeneratorContext context)
        {
            context.GeneratedClass.BaseTypes.Clear();
            context.GeneratedClass.BaseTypes.Add(new CodeTypeReference(ResolveType(context)));

            #region Work Around
            if (!(context.Host.CodeLanguage is VBRazorCodeLanguage))
            {
                context.GeneratedClass.LinePragma = context.GenerateLinePragma(target, CalculatePadding(context.Host, target, 0));
            }
            //else
            // exclude VBRazorCodeLanguage
            // with VB I found a problem with the #End ExternalSource directive rendered at the GeneratedClass's end while it should not be rendered
            // this only effects the compile error report

            #endregion
        }