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


C# TSqlObject.GetProperty方法代码示例

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


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

示例1: IsDateTime2WithExcessiveScale

        private bool IsDateTime2WithExcessiveScale(TSqlObject column)
        {
            var dataType = GetDataType(column);

            var scale = column.GetProperty<int>(Column.Scale);
            

            return (dataType == SqlDataType.DateTime2 && scale > 2);
        }
开发者ID:DidItSave,项目名称:CustomCodeRulesForSSDT,代码行数:9,代码来源:DateTimeColumnsWith7ScaleRule.cs

示例2: 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

示例3: GetSchemaForColumn

        private static ColumnInfo GetSchemaForColumn(TSqlObject model)
        {
            TSqlObject type = model.GetReferenced(Column.DataType).First();
            string dataType = type.Name.Parts[0];
            bool isNullable = model.GetProperty<bool>(Column.Nullable);
            int length = model.GetProperty<int>(Column.Length);

            return new ColumnInfo
            {
                Name = model.Name.Parts[2],
                FullName = model.Name.ToString(),
                SqlDataType = dataType,
                ClrType = GetTypeMapping(dataType, isNullable),
                Nullable = isNullable,
                Length = length
            };
        }
开发者ID:modulexcite,项目名称:T4Generators,代码行数:17,代码来源:DatabaseSchema.cs

示例4: ValidateViewHasSchemaBinding

 /// <summary>
 // Views must be schema bound if they reference a memory optimized table
 /// </summary>
 private static void ValidateViewHasSchemaBinding(SqlRuleExecutionContext context, TSqlObject view, TSqlObject table,
     IList<SqlRuleProblem> problems)
 {
     if (!view.GetProperty<bool>(View.WithSchemaBinding))
     {
         string description = string.Format(CultureInfo.CurrentCulture,
             RuleResources.ViewsOnMemoryOptimizedTable_SchemaBindingProblemDescription,
             RuleUtils.GetElementName(context, view),
             RuleUtils.GetElementName(context, table));
         TSqlFragment nameFragment = TsqlScriptDomUtils.LookupSchemaObjectName(view);
         problems.Add(new SqlRuleProblem(description, view, nameFragment));
     }
 }
开发者ID:GoEddie,项目名称:DACExtensions,代码行数:16,代码来源:ViewsOnMemoryOptimizedTableRule.cs


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