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


C# IEdmStructuredType.IsODataComplexTypeKind方法代码示例

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


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

示例1: ShouldWritePropertyInContent

 private bool ShouldWritePropertyInContent(IEdmStructuredType owningType, ProjectedPropertiesAnnotation projectedProperties, string propertyName, object propertyValue, EpmSourcePathSegment epmSourcePathSegment)
 {
     bool flag = !projectedProperties.ShouldSkipProperty(propertyName);
     if ((((base.MessageWriterSettings.WriterBehavior != null) && base.MessageWriterSettings.WriterBehavior.UseV1ProviderBehavior) && (owningType != null)) && owningType.IsODataComplexTypeKind())
     {
         IEdmComplexType complexType = (IEdmComplexType) owningType;
         CachedPrimitiveKeepInContentAnnotation annotation = base.Model.EpmCachedKeepPrimitiveInContent(complexType);
         if ((annotation != null) && annotation.IsKeptInContent(propertyName))
         {
             return flag;
         }
     }
     if ((propertyValue == null) && (epmSourcePathSegment != null))
     {
         return true;
     }
     EntityPropertyMappingAttribute entityPropertyMapping = EpmWriterUtils.GetEntityPropertyMapping(epmSourcePathSegment);
     if (entityPropertyMapping == null)
     {
         return flag;
     }
     string str = propertyValue as string;
     if ((str != null) && (str.Length == 0))
     {
         switch (entityPropertyMapping.TargetSyndicationItem)
         {
             case SyndicationItemProperty.AuthorEmail:
             case SyndicationItemProperty.AuthorUri:
             case SyndicationItemProperty.ContributorEmail:
             case SyndicationItemProperty.ContributorUri:
                 return true;
         }
     }
     return (entityPropertyMapping.KeepInContent && flag);
 }
开发者ID:nickchal,项目名称:pash,代码行数:35,代码来源:ODataAtomPropertyAndValueSerializer.cs

示例2: ShouldWritePropertyInContent

        /// <summary>
        /// Determines if the property with the specified value should be written into content or not.
        /// </summary>
        /// <param name="owningType">The owning type of the property to be checked.</param>
        /// <param name="projectedProperties">The set of projected properties for the <paramref name="owningType"/></param>
        /// <param name="propertyName">The name of the property to be checked.</param>
        /// <param name="propertyValue">The property value to write.</param>
        /// <param name="epmSourcePathSegment">The EPM source path segment for the property being written.</param>
        /// <returns>true if the property should be written into content, or false otherwise</returns>
        private bool ShouldWritePropertyInContent(
            IEdmStructuredType owningType,
            ProjectedPropertiesAnnotation projectedProperties,
            string propertyName,
            object propertyValue,
            EpmSourcePathSegment epmSourcePathSegment)
        {
            // check whether the property is projected; if no EPM is specified for the property the projection decides 
            bool propertyProjected = !projectedProperties.ShouldSkipProperty(propertyName);

            bool useV1ProviderBehavior = this.MessageWriterSettings.WriterBehavior == null ? false : this.MessageWriterSettings.WriterBehavior.UseV1ProviderBehavior;
            if (useV1ProviderBehavior && owningType != null && owningType.IsODataComplexTypeKind())
            {
                IEdmComplexType owningComplexType = (IEdmComplexType)owningType;
                CachedPrimitiveKeepInContentAnnotation keepInContentAnnotation = this.Model.EpmCachedKeepPrimitiveInContent(owningComplexType);
                if (keepInContentAnnotation != null && keepInContentAnnotation.IsKeptInContent(propertyName))
                {
                    return propertyProjected;
                }
            }

            // We sometimes write properties into content even if asked not to.
            // If the property value is null and the property (or one of its descendant properties) is mapped, 
            // we always write into content, even if the property was not projected.
            if (propertyValue == null && epmSourcePathSegment != null)
            {
                return true;
            }

            EntityPropertyMappingAttribute entityPropertyMapping = EpmWriterUtils.GetEntityPropertyMapping(epmSourcePathSegment);
            if (entityPropertyMapping == null)
            {
                return propertyProjected;
            }

            string stringPropertyValue = propertyValue as string;
            if (stringPropertyValue != null && stringPropertyValue.Length == 0)
            {
                // If the property value is an empty string and we should be writing it into an ATOM element which does not allow empty string
                // we write it into content as well, also even if the property was not projected.
                switch (entityPropertyMapping.TargetSyndicationItem)
                {
                    case SyndicationItemProperty.AuthorEmail:
                    case SyndicationItemProperty.AuthorUri:
                    case SyndicationItemProperty.ContributorEmail:
                    case SyndicationItemProperty.ContributorUri:
                        return true;

                    default:
                        break;
                }
            }

            return entityPropertyMapping.KeepInContent && propertyProjected;
        }
开发者ID:smasonuk,项目名称:odata-sparql,代码行数:64,代码来源:ODataAtomPropertyAndValueSerializer.cs


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