当前位置: 首页>>代码示例>>C#>>正文


C# TSqlObject.TryGetScript方法代码示例

本文整理汇总了C#中TSqlObject.TryGetScript方法的典型用法代码示例。如果您正苦于以下问题:C# TSqlObject.TryGetScript方法的具体用法?C# TSqlObject.TryGetScript怎么用?C# TSqlObject.TryGetScript使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TSqlObject的用法示例。


在下文中一共展示了TSqlObject.TryGetScript方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetScript

        private static string GetScript(TSqlObject procedure)
        {
            var script = "";
            if (procedure.TryGetScript(out script))
                return script;

            return "";  //could throw an exception or logged this if we care??
        }
开发者ID:modulexcite,项目名称:DacFxApi,代码行数:8,代码来源:Program.cs

示例2: DumpScript

 private static void DumpScript(TSqlObject parent)
 {
     var script = "";
     if (parent.TryGetScript(out script))
     {
         Console.WriteLine(script);
     }
 }
开发者ID:GoEddie,项目名称:DacpacExplorer,代码行数:8,代码来源:Program.cs

示例3: DumpIndex

        private static void DumpIndex(TSqlObject index)
        {
            //Each TSqlObject has a name property:
            ObjectIdentifier indexName = index.Name;

            //Top level objects like tables, procedures and indexes will let you get the underlying script to generate them, doing this on things like columns fails
            string script = "";

            if (!index.TryGetScript(out script))
            {
                script = "Can only script top level objects";
            }

            //To get to individual properties we need to use the static schema container classes, each property can be called directly or you can ask an object for all it's child properties
            var allowPageLocks = index.GetProperty<bool?>(Index.AllowPageLocks);
            var isClustered = index.GetProperty<bool?>(Index.Clustered);

            Console.WriteLine("Index: " + indexName);
            Console.WriteLine("Properties: Is Clustered: {0}, Allow Page Locks: {1}", isClustered, allowPageLocks);

            //To get the columns we need to ask for the relationships of the index and then enumerate through them
            foreach (ModelRelationshipInstance column in index.GetReferencedRelationshipInstances(Index.Columns))
            {
                DumpColumn(column, "Column");
            }

            //Included columns are referenced using the relationships but are a slightly different class
            foreach (ModelRelationshipInstance column in index.GetReferencedRelationshipInstances(Index.IncludedColumns))
            {
                DumpColumn(column, "Included");
            }

            Console.WriteLine("Script:");
            Console.WriteLine(script);
            Console.WriteLine("===============================");
        }
开发者ID:modulexcite,项目名称:DacFxApi,代码行数:36,代码来源:Program.cs

示例4: GetScript

        private string GetScript(TSqlObject table)
        {
            var script = "";

            if (!table.TryGetScript(out script))
            {
                script = "Object doesn't have script, see top level object instead";
            }

            return script;
        }
开发者ID:GoEddie,项目名称:DacpacExplorer,代码行数:11,代码来源:Explorer.xaml.cs


注:本文中的TSqlObject.TryGetScript方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。