コード例 #1
0
ファイル: Generator.cs プロジェクト: nicknystrom/NSprocs
 public Generator(
     Options Options,
     SqlSignatures Signatures)
 {
     this.Options = Options;
     this.Signatures = Signatures;
 }
コード例 #2
0
 public Generator(
     Options Options,
     SqlSignatures Signatures)
 {
     this.Options    = Options;
     this.Signatures = Signatures;
 }
コード例 #3
0
        protected byte[] GenerateCode(
            IVsGeneratorProgress progress,
            string file,
            string contents,
            string ns)
        {
            try
            {
                // Parse options from Xml source doc
                Options = new Options(contents);

                // read all sprocs from the database
                var sigs = new SqlSignatures(Options);

                // Create the code generator
                var g = new Generators.SqlServer.Generator(
                    Options,
                    sigs);

                // Setup code generation options
                var options = new CodeGeneratorOptions
                {
                    BlankLinesBetweenMembers = false,
                    BracingStyle             = "C",
                    ElseOnClosing            = false,
                    IndentString             = "\t"
                };

                // Create the output
                var output = new StringWriter();

                GetProvider()
                .GenerateCodeFromNamespace(
                    g.GenerateCode(ns),
                    output,
                    options);
                output.Close();
                return(Encoding.UTF8.GetBytes(output.ToString()));
            }
            catch (LineNumberedException e)
            {
                progress.GeneratorError(false, 1, e.Message, e.Line, e.Col);
                return(null);
            }
            catch (Exception e)
            {
                progress.GeneratorError(false, 1, e.ToString(), 0, 0);
                return(null);
            }
        }
コード例 #4
0
ファイル: CodeGenerator.cs プロジェクト: nicknystrom/NSprocs
        protected byte[] GenerateCode(
            IVsGeneratorProgress progress,
            string file,
            string contents,
            string ns)
        {
            try
            {
                // Parse options from Xml source doc
                Options = new Options(contents);

                // read all sprocs from the database
                var sigs = new SqlSignatures(Options);

                // Create the code generator
                var g = new Generators.SqlServer.Generator(
                        Options,
                        sigs);

                // Setup code generation options
                var options = new CodeGeneratorOptions
                {
                    BlankLinesBetweenMembers = false,
                    BracingStyle = "C",
                    ElseOnClosing = false,
                    IndentString = "\t"
                };

                // Create the output
                var output = new StringWriter();

                GetProvider()
                    .GenerateCodeFromNamespace(
                    g.GenerateCode(ns),
                    output,
                    options);
                output.Close();
                return Encoding.UTF8.GetBytes(output.ToString());

            }
            catch (LineNumberedException e)
            {
                progress.GeneratorError(false, 1, e.Message, e.Line, e.Col);
                return null;
            }
            catch (Exception e)
            {
                progress.GeneratorError(false, 1, e.ToString(), 0, 0);
                return null;
            }
        }