private void CreatetSQLtSchema(object sender, EventArgs e)
        {
            var dte = (DTE)GetService(typeof(DTE));

            if (dte.ActiveDocument == null)
            {
                return;
            }

            var doc = dte.ActiveDocument.Object("TextDocument") as TextDocument;

            if (null == doc)
            {
                return;
            }

            var ep = doc.StartPoint.CreateEditPoint();

            ep.EndOfDocument();

            var length = ep.AbsoluteCharOffset;

            ep.StartOfDocument();

            var originalText = ep.GetText(length);

            var builder = new SchemaBuilder(originalText);

            builder.CreateSchemas();
        }
예제 #2
0
        private void CreatetSQLtSchema(object sender, EventArgs e)
        {
            try
            {
                var dte = (DTE)GetService(typeof(DTE));

                if (dte.ActiveDocument == null)
                {
                    return;
                }

                var doc = dte.ActiveDocument.Object("TextDocument") as TextDocument;
                if (null == doc)
                {
                    return;
                }

                var ep = doc.StartPoint.CreateEditPoint();

                ep.EndOfDocument();

                var length = ep.AbsoluteCharOffset;
                ep.StartOfDocument();

                var originalText = ep.GetText(length);

                var builder = new SchemaBuilder(originalText);
                builder.CreateSchemas();
            }
            catch (Exception ex)
            {
                OutputPane.WriteMessage("Exception creating tSQLt schema, error: {0}", ex.Message);
            }
        }