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


C# TSqlObject.GetReferencedRelationshipInstances方法代码示例

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


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

示例1: AddPropertiesForIndex

        private void AddPropertiesForIndex(Panel panel, TSqlObject index)
        {

            foreach (var reference in index.GetReferencedRelationshipInstances(Index.Columns))
            {
                panel.Children.Add(GetPropertyLabel("Column: ", reference.ObjectName + " " + (reference.GetProperty<bool>(Index.ColumnsRelationship.Ascending) ? "ASC" : "DESC")));
            }

            if (index.GetReferencedRelationshipInstances(Index.IncludedColumns).Any())
            {
                foreach (var reference in index.GetReferencedRelationshipInstances(Index.IncludedColumns))
                {
                    panel.Children.Add(GetPropertyLabel("Included Column: ", reference.ObjectName.ToString()));
                }
            }
        }
开发者ID:GoEddie,项目名称:DacpacExplorer,代码行数:16,代码来源:PropertiesPageBuilder.cs

示例2: HasParameterBeenRemoved

        private static bool HasParameterBeenRemoved(ModelRelationshipInstance parameter, TSqlObject oldProcedure)
        {
            /*
                A parameter does not exist in the old model
            */

            return
                oldProcedure.GetReferencedRelationshipInstances(Procedure.Parameters)
                    .FirstOrDefault(p => p.ObjectName.Parts.Last() == parameter.ObjectName.Parts.Last()) == null;
        }
开发者ID:GoEddie,项目名称:Contributors,代码行数:10,代码来源:DeploymentFilter.cs

示例3: ShowColumnsDataType

        private static void ShowColumnsDataType(TSqlObject table)
        {
            foreach (var child in table.GetReferencedRelationshipInstances(Table.Columns))
            {
                var type = child.Object.GetReferenced(Column.DataType).FirstOrDefault();
                var isNullable = type.GetProperty<bool?> (DataType.UddtNullable);
                var length = type.GetProperty<int?>(DataType.UddtLength);

                //do something useful with this information!
            }
        }
开发者ID:modulexcite,项目名称:DacFxApi,代码行数:11,代码来源:Program.cs

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

示例5: HasParameterBeenAddedWithoutDefaultValue

        private static bool HasParameterBeenAddedWithoutDefaultValue(ModelRelationshipInstance parameter,
            TSqlObject newProcedure)
        {
            var hasDefault = parameter.Object.GetProperty(Parameter.DefaultExpression) != null;

            var parameterInOldModel =
                newProcedure.GetReferencedRelationshipInstances(Procedure.Parameters)
                    .FirstOrDefault(p => p.ObjectName.Parts.Last() == parameter.ObjectName.Parts.Last());

            /*
                A parameter did not exist in the old model and has no default
            */

            if (parameterInOldModel == null && !hasDefault)
            {
                return true;
            }

            return false;
        }
开发者ID:GoEddie,项目名称:Contributors,代码行数:20,代码来源:DeploymentFilter.cs

示例6: AddPropertiesForDmlTrigger

        private void AddPropertiesForDmlTrigger(Panel panel, TSqlObject key)
        {
            var duplicateRemover = new Dictionary<string, bool>();

            foreach (var reference in key.GetReferencedRelationshipInstances(DmlTrigger.BodyDependencies))
            {
                var name = reference.ObjectName.ToString();

                if (!duplicateRemover.ContainsKey(name))
                {
                    panel.Children.Add(GetPropertyLabel("Dependency ", name));
                    duplicateRemover[name] = true;
                }
            }
        }
开发者ID:GoEddie,项目名称:DacpacExplorer,代码行数:15,代码来源:PropertiesPageBuilder.cs

示例7: AddPropertiesForDefaultConstraint

 private void AddPropertiesForDefaultConstraint(Panel panel, TSqlObject key)
 {
     foreach (var reference in key.GetReferencedRelationshipInstances(DefaultConstraint.TargetColumn))
     {
         panel.Children.Add(GetPropertyLabel("Target Column: ", reference.ObjectName.ToString()));
     }
 }
开发者ID:GoEddie,项目名称:DacpacExplorer,代码行数:7,代码来源:PropertiesPageBuilder.cs

示例8: AddPropertiesForPrimaryKey

 private void AddPropertiesForPrimaryKey(Panel panel, TSqlObject key)
 {
     foreach (var reference in key.GetReferencedRelationshipInstances(PrimaryKeyConstraint.Columns))
     {
         panel.Children.Add(GetPropertyLabel("Column: ", reference.ObjectName + " " + (reference.GetProperty<bool>(PrimaryKeyConstraint.ColumnsRelationship.Ascending) ? "ASC" : "DESC")));
     }
 }
开发者ID:GoEddie,项目名称:DacpacExplorer,代码行数:7,代码来源:PropertiesPageBuilder.cs

示例9: AddPropertiesForForeignKey

        private void AddPropertiesForForeignKey(Panel panel, TSqlObject key)
        {
            foreach (var reference in key.GetReferencedRelationshipInstances(ForeignKeyConstraint.Columns))
            {
                panel.Children.Add(GetPropertyLabel("Column: ", reference.ObjectName.ToString()));
            }

            foreach (var reference in key.GetReferencedRelationshipInstances(ForeignKeyConstraint.ForeignTable))
            {
                panel.Children.Add(GetPropertyLabel("Foreign Table: ", reference.ObjectName.ToString()));
            }
            foreach (var reference in key.GetReferencedRelationshipInstances(ForeignKeyConstraint.ForeignColumns))
            {
                panel.Children.Add(GetPropertyLabel("Foreign Column: ", reference.ObjectName.ToString()));
            }

        }
开发者ID:GoEddie,项目名称:DacpacExplorer,代码行数:17,代码来源:PropertiesPageBuilder.cs

示例10: GetComposedChildren

 /// <summary>
 /// Filter referenced objects to only return composed children. These are objects that have a real
 /// parent-child relationship and couldn't be defined on their own. The canonical example is that
 /// a Table->Column is a composing relationship and we'd only get to navigate to the Column via the Table
 /// reference. To avoid loops we don't want to traverse Hierarchical or Peer relationships. Those can refer to other 
 /// top-level objects or objects that are composed children of a different top-level object, and hence would
 /// cause us to iterate multiple times over an object in the model.
 /// 
 /// Note that <see cref="TSqlObject.GetReferencedRelationshipInstances()"/> may return relationships
 /// where there is no object to in the model for the reference. This can happen if the object on that 
 /// side of the relationship is from a referenced dacpac. Hence we check that the 
 /// <see cref="ModelRelationshipInstance.Object"/> is not null when filtering our objects
 /// </summary>
 private IEnumerable<TSqlObject> GetComposedChildren(TSqlObject tSqlObject)
 {
     return from rel
            in tSqlObject.GetReferencedRelationshipInstances(DacExternalQueryScopes.UserDefined)
            where rel.Relationship.Type == RelationshipType.Composing && rel.Object != null
            select rel.Object;
 }
开发者ID:GoEddie,项目名称:DACExtensions,代码行数:20,代码来源:CapitalizedNamesRule.cs

示例11: GetColumnDefinitions

        private List<ColumnDescriptor> GetColumnDefinitions(TSqlObject table)
        {
            var columns = new List<ColumnDescriptor>();

            foreach (var column in table.GetReferencedRelationshipInstances(Microsoft.SqlServer.Dac.Model.Table.Columns))
            {
                var definition = CreateColumnDefinition(column);
                if(definition != null)
                    columns.Add(definition);
            }

            return columns;
        }
开发者ID:ternaryalchemy,项目名称:MergeUi,代码行数:13,代码来源:DacParser.cs

示例12: HasDefaultValueBeenRemoved

        private bool HasDefaultValueBeenRemoved(ModelRelationshipInstance parameter, TSqlObject oldProcedure)
        {
            var newParameterHasDefault = parameter.Object.GetProperty(Parameter.DefaultExpression) != null;

            var parameterInOldModel =
                oldProcedure.GetReferencedRelationshipInstances(Procedure.Parameters)
                    .FirstOrDefault(p => p.ObjectName.Parts.Last() == parameter.ObjectName.Parts.Last());

            /*
                A parameter in the new model has no default but it had a default in the old model...
            */

            if (parameterInOldModel != null && !newParameterHasDefault && (parameterInOldModel.Object.GetProperty(Parameter.DefaultExpression) != null))
            {
                return true;
            }

            return false;
        }
开发者ID:GoEddie,项目名称:Contributors,代码行数:19,代码来源:DeploymentFilter.cs


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