Пример #1
0
        public void WriteTo(CSharpContext context, CSharpPackage package, CSharpWriter writer)
        {
            using (var bodyWriter = new CSharpWriter())
            {
                // render body first, so usings are resolved
                using (bodyWriter.WriteIndentedBlock(prefix: $"namespace {CSharpHelpers.CombineNamespaces(package.Namespace, this.RelativeNamespace)} "))
                {
                    foreach (var fragment in Fragments)
                    {
                        fragment.WriteTo(context, package, this, bodyWriter);
                    }
                }

                bodyWriter.Flush();

                // render usings
                if (Usings.Count > 0)
                {
                    foreach (var @using in Usings)
                    {
                        writer.WriteIndented($"using {@using};");
                    }

                    writer.WriteLine();
                }

                // render body
                bodyWriter.WriteTo(writer);
            }
        }
Пример #2
0
 public abstract void WriteTo(CSharpContext context, CSharpPackage package, CSharpModule module, CSharpWriter writer);
Пример #3
0
 public virtual IEnumerable <CSharpMapping> CreateMappings(CSharpContext context, CSharpPackage package, CSharpModule module)
 {
     yield break;
 }