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


C# Property.GetAntiDependenciesOfType方法代码示例

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


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

示例1: IsDependentSidePropertyInAssociation

        // detects whether the S-side Property represents the dependent side of an Association (e.g. for Split Entity or TPT or C-side Conditions)
        private static bool IsDependentSidePropertyInAssociation(Property storageProperty)
        {
            if (storageProperty == null
                || storageProperty.EntityModel.IsCSDL)
            {
                Debug.Fail(
                    "should only receive a storage-side Property. Received property: "
                    + (storageProperty == null ? "NULL" : storageProperty.ToPrettyString()));
                return true; // returning true will mean this table's SGP settings will not be adjusted
            }

            foreach (var propRef in storageProperty.GetAntiDependenciesOfType<PropertyRef>())
            {
                var assoc = propRef.GetParentOfType(typeof(Association)) as Association;
                if (assoc == null)
                {
                    // no Association parent - so ignore this PropertyRef
                    continue;
                }

                foreach (var prop in assoc.DependentRoleProperties)
                {
                    if (storageProperty.Equals(prop))
                    {
                        // found storage property on the dependent side which is part of an association
                        return true;
                    }
                }
            }

            return false;
        }
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:33,代码来源:PropagateStoreGeneratedPatternToStorageModel.cs

示例2: FindAllMappedSSidePropertiesForCSideProperty

        private static ICollection<Property> FindAllMappedSSidePropertiesForCSideProperty(Property cSideProp)
        {
            Debug.Assert(
                cSideProp.EntityModel.IsCSDL,
                "cSideProp with name " + cSideProp.NormalizedNameExternal + " is from SSDL, it must be from CSDL");

            ICollection<Property> sSideProps = new List<Property>();
            // return all the S-side Properties we find that map to
            // the cSideProp argument
            var scalarProps = cSideProp.GetAntiDependenciesOfType<ScalarProperty>();
            foreach (var scalarProp in scalarProps)
            {
                // if the scalarProp is not from a MappingFragment then ignore
                // (we want the column mapping, not e.g. an EndProperty mapping)
                if (!(scalarProp.Parent is MappingFragment))
                {
                    continue;
                }

                var sSideProp = scalarProp.ColumnName.Target;
                if (null != sSideProp)
                {
                    sSideProps.Add(sSideProp);
                }
            }

            return sSideProps;
        }
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:28,代码来源:UpdateConceptualAndMappingModelsCommand.cs

示例3: IsStorageForNonRootEntityType

        // detects whether the S-side Property is within the table which provides storage for a C-side non-root EntityType (e.g. in a TPT hierarchy)
        private static bool IsStorageForNonRootEntityType(Property storageProperty)
        {
            if (storageProperty == null
                || storageProperty.EntityModel.IsCSDL)
            {
                Debug.Fail(
                    "should only receive a storage-side Property. Received property: "
                    + (storageProperty == null ? "NULL" : storageProperty.ToPrettyString()));
                return true; // returning true will mean this table's SGP settings will not be adjusted
            }

            foreach (var sp in storageProperty.GetAntiDependenciesOfType<ScalarProperty>())
            {
                var etm = sp.GetParentOfType(typeof(EntityTypeMapping)) as EntityTypeMapping;
                if (etm == null)
                {
                    // no EntityTypeMapping parent - so don't count this mapping
                    continue;
                }

                var etmKind = etm.Kind;
                if (EntityTypeMappingKind.Default != etmKind
                    && EntityTypeMappingKind.IsTypeOf != etmKind)
                {
                    // EntityTypeMapping is not for Default or IsTypeOf mapping - so don't count for finding the corresponding C-side EntityType
                    continue;
                }

                var cSideEntityType = etm.FirstBoundConceptualEntityType;
                if (cSideEntityType != null
                    && cSideEntityType.HasResolvableBaseType)
                {
                    var inheritanceStrategy = ModelHelper.DetermineCurrentInheritanceStrategy(cSideEntityType);
                    if (InheritanceMappingStrategy.TablePerType == inheritanceStrategy)
                    {
                        // C-side EntityType has TPT inheritance strategy and is not the base-most type in its inheritance hierarchy
                        return true;
                    }
                }
            }

            return false;
        }
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:44,代码来源:PropagateStoreGeneratedPatternToStorageModel.cs

示例4: FindMappedCSidePropertyForSSideProperty

        private static Property FindMappedCSidePropertyForSSideProperty(Property sSideProp)
        {
            Debug.Assert(
                !sSideProp.EntityModel.IsCSDL,
                "sSideProp with name " + sSideProp.NormalizedNameExternal + " is from CSDL, it must be from SSDL");

            // just return the first C-side Property we find that maps to
            // the sSideProp argument - just need type etc information from
            // it in order to clone a C-side Property in the existing artifact
            var scalarProps = sSideProp.GetAntiDependenciesOfType<ScalarProperty>();
            foreach (var scalarProp in scalarProps)
            {
                // if the scalarProp is not from a MappingFragment then ignore
                // (we want the column mapping, not e.g. an EndProperty mapping)
                if (!(scalarProp.Parent is MappingFragment))
                {
                    continue;
                }

                var cSideProp = scalarProp.Name.Target;
                if (null != cSideProp)
                {
                    return cSideProp;
                }
            }

            return null;
        }
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:28,代码来源:UpdateConceptualAndMappingModelsCommand.cs


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