Пример #1
0
        public void SourceCodeBasicFeature()
        {
            var sc = new SourceCode();
            sc.UsingNamespaces.Add("System");
            sc.UsingNamespaces.Add("System.Collection");
            sc.UsingNamespaces.Add("System.Data");
            sc.UsingNamespaces.Add("System.IO");

            Assert.AreEqual("using System;" + SourceCodeGenerator.NewLine
                + "using System.Collection;" + SourceCodeGenerator.NewLine
                + "using System.Data;" + SourceCodeGenerator.NewLine
                + "using System.IO;" + SourceCodeGenerator.NewLine
                + SourceCodeGenerator.NewLine
                , SourceCodeGenerator.Write(SourceCodeLanguage.CSharp, sc));
        }
        public override SourceCodeFile Create(String directoryPath, String namespaceName)
        {
            var t = this.Table;
            var sc = new SourceCode();

            sc.UsingNamespaces.Add("System");
            sc.UsingNamespaces.Add("System.Data");
            sc.UsingNamespaces.Add("System.Text");
            sc.UsingNamespaces.Add("HigLabo.DbSharp");

            var ns = new Namespace(namespaceName);
            ns.Classes.Add(CreateClass());
            sc.Namespaces.Add(ns);

            return new SourceCodeFile(Path.Combine(directoryPath, t.Name + ".IRecord.cs"), sc);
        }
Пример #3
0
        public override void Write(SourceCode sourceCode)
        {
            var writer = this.TextWriter;
            var sc     = sourceCode;

            this.CurrentIndentLevel = 0;
            foreach (var item in sourceCode.UsingNamespaces)
            {
                writer.Write("using ");
                writer.Write(item);
                writer.WriteLine(";");
            }
            writer.WriteLine();
            foreach (var item in sourceCode.Namespaces)
            {
                this.Write(item);
            }
        }
        public override SourceCodeFile Create(String directoryPath, String namespaceName)
        {
            var sp = this.UserDefinedTableType;
            var sc = new SourceCode();

            sc.UsingNamespaces.Add("System");
            sc.UsingNamespaces.Add("System.Text");
            sc.UsingNamespaces.Add("System.Data");
            sc.UsingNamespaces.Add("System.Collections.Generic");
            sc.UsingNamespaces.Add("System.ComponentModel");
            sc.UsingNamespaces.Add("HigLabo.DbSharp");

            var ns = new Namespace(namespaceName);
            ns.Classes.Add(CreateClass());
            sc.Namespaces.Add(ns);

            return new SourceCodeFile(Path.Combine(directoryPath, sp.Name + ".cs"), sc);
        }
 public override void Write(SourceCode sourceCode)
 {
     throw new NotImplementedException();
 }
Пример #6
0
 public SourceCodeFile(String filePath, SourceCode sourceCode)
 {
     this.FilePath = filePath;
     this.SourceCode = sourceCode;
 }
Пример #7
0
 public abstract void Write(SourceCode sourceCode);
 public override void Write(SourceCode sourceCode)
 {
     throw new NotImplementedException();
 }
Пример #9
0
 public abstract void Write(SourceCode sourceCode);
Пример #10
0
 public static String Write(SourceCodeLanguage language, SourceCode sourceCode)
 {
     var sc = Create(language);
     sc.Write(sourceCode);
     return sc.TextWriter.ToString();
 }