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


C# IEdmStructuredType类代码示例

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


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

示例1: SelectBinder

        /// <summary>
        /// Constructs a new SelectBinder.
        /// </summary>
        /// <param name="model">The model used for binding.</param>
        /// <param name="edmType">The entity type that the $select is being applied to.</param>
        /// <param name="maxDepth">the maximum recursive depth.</param>
        /// <param name="expandClauseToDecorate">The already built expand clause to decorate</param>
       /// <param name="resolver">Resolver for uri parser.</param>
        public SelectBinder(IEdmModel model, IEdmStructuredType edmType, int maxDepth, SelectExpandClause expandClauseToDecorate, ODataUriResolver resolver = null)
        {
            ExceptionUtils.CheckArgumentNotNull(model, "tokenIn");
            ExceptionUtils.CheckArgumentNotNull(edmType, "entityType");

            this.visitor = new SelectPropertyVisitor(model, edmType, maxDepth, expandClauseToDecorate, resolver);
        }
开发者ID:larsenjo,项目名称:odata.net,代码行数:15,代码来源:SelectBinder.cs

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

示例3: GetPropertyInfo

        /// <summary>
        /// Gets the property info for the EDM property declared on this type.
        /// </summary>
        /// <param name="structuredType">The structured type to get the property on.</param>
        /// <param name="property">Property instance to get the property info for.</param>
        /// <param name="model">The model containing annotations.</param>
        /// <returns>Returns the PropertyInfo object for the specified EDM property.</returns>
        internal PropertyInfo GetPropertyInfo(IEdmStructuredType structuredType, IEdmProperty property, IEdmModel model)
        {
            DebugUtils.CheckNoExternalCallers();
            Debug.Assert(structuredType != null, "structuredType != null");
            Debug.Assert(property != null, "property != null");
            Debug.Assert(model != null, "model != null");
            Debug.Assert(property.GetCanReflectOnInstanceTypeProperty(model), "property.CanReflectOnInstanceTypeProperty()");
#if DEBUG
            Debug.Assert(structuredType.ContainsProperty(property), "The structuredType does not define the specified property.");
#endif

            if (this.propertyInfosDeclaredOnThisType == null)
            {
                this.propertyInfosDeclaredOnThisType = new Dictionary<IEdmProperty, PropertyInfo>(ReferenceEqualityComparer<IEdmProperty>.Instance);
            }

            PropertyInfo propertyInfo;
            if (!this.propertyInfosDeclaredOnThisType.TryGetValue(property, out propertyInfo))
            {
                BindingFlags bindingFlags = BindingFlags.Public | BindingFlags.Instance;
                propertyInfo = structuredType.GetInstanceType(model).GetProperty(property.Name, bindingFlags);
                if (propertyInfo == null)
                {
                    throw new ODataException(Strings.PropertyInfoTypeAnnotation_CannotFindProperty(structuredType.ODataFullName(), structuredType.GetInstanceType(model), property.Name));
                }

                this.propertyInfosDeclaredOnThisType.Add(property, propertyInfo);
            }

            Debug.Assert(propertyInfo != null, "propertyInfo != null");
            return propertyInfo;
        }
开发者ID:smasonuk,项目名称:odata-sparql,代码行数:39,代码来源:PropertyInfoTypeAnnotation.cs

示例4: CreatePropertyDictionary

        public static IReadOnlyDictionary<string, object> CreatePropertyDictionary(
            this Delta entity, IEdmStructuredType edmType, ApiBase api, bool isCreation)
        {
            var propertiesAttributes = RetrievePropertiesAttributes(edmType, api);

            Dictionary<string, object> propertyValues = new Dictionary<string, object>();
            foreach (string propertyName in entity.GetChangedPropertyNames())
            {
                PropertyAttributes attributes;
                if (propertiesAttributes != null && propertiesAttributes.TryGetValue(propertyName, out attributes))
                {
                    if ((isCreation && (attributes & PropertyAttributes.IgnoreForCreation) != PropertyAttributes.None)
                      || (!isCreation && (attributes & PropertyAttributes.IgnoreForUpdate) != PropertyAttributes.None))
                    {
                        // Will not get the properties for update or creation
                        continue;
                    }
                }

                object value;
                if (entity.TryGetPropertyValue(propertyName, out value))
                {
                    var complexObj = value as EdmComplexObject;
                    if (complexObj != null)
                    {
                        value = CreatePropertyDictionary(complexObj, complexObj.ActualEdmType, api, isCreation);
                    }

                    propertyValues.Add(propertyName, value);
                }
            }

            return propertyValues;
        }
开发者ID:chinadragon0515,项目名称:RESTier,代码行数:34,代码来源:Extensions.cs

示例5: EdmStructuredType

		protected EdmStructuredType(bool isAbstract, bool isOpen, IEdmStructuredType baseStructuredType)
		{
			this.declaredProperties = new List<IEdmProperty>();
			this.propertiesDictionary = new Cache<EdmStructuredType, IDictionary<string, IEdmProperty>>();
			this.isAbstract = isAbstract;
			this.isOpen = isOpen;
			this.baseStructuredType = baseStructuredType;
		}
开发者ID:nickchal,项目名称:pash,代码行数:8,代码来源:EdmStructuredType.cs

示例6: SelectPropertyVisitor

 /// <summary>
 /// Build a property visitor to visit the select tree and decorate a SelectExpandClause
 /// </summary>
 /// <param name="model">The model used for binding.</param>
 /// <param name="edmType">The entity type that the $select is being applied to.</param>
 /// <param name="maxDepth">the maximum recursive depth.</param>
 /// <param name="expandClauseToDecorate">The already built expand clause to decorate</param>
 /// <param name="resolver">Resolver for uri parser.</param>
 public SelectPropertyVisitor(IEdmModel model, IEdmStructuredType edmType, int maxDepth, SelectExpandClause expandClauseToDecorate, ODataUriResolver resolver)
 {
     this.model = model;
     this.edmType = edmType;
     this.maxDepth = maxDepth;
     this.expandClauseToDecorate = expandClauseToDecorate;
     this.resolver = resolver ?? ODataUriResolver.Default;
 }
开发者ID:TomDu,项目名称:odata.net,代码行数:16,代码来源:SelectPropertyVisitor.cs

示例7: EdmProperty

		protected EdmProperty(IEdmStructuredType declaringType, string name, IEdmTypeReference type) : base(name)
		{
			this.dependents = new HashSetInternal<IDependent>();
			EdmUtil.CheckArgumentNull<IEdmStructuredType>(declaringType, "declaringType");
			EdmUtil.CheckArgumentNull<IEdmTypeReference>(type, "type");
			this.declaringType = declaringType;
			this.type = type;
		}
开发者ID:nickchal,项目名称:pash,代码行数:8,代码来源:EdmProperty.cs

示例8: SelectExpandBinder

        /// <summary>
        /// Build the ExpandOption variant of an SelectExpandBinder
        /// </summary>
        /// <param name="configuration">The configuration used for binding.</param>
        /// <param name="edmType">The type of the top level expand item.</param>
        /// <param name="navigationSource">The navigation source of the top level expand item.</param>
        public SelectExpandBinder(ODataUriParserConfiguration configuration, IEdmStructuredType edmType, IEdmNavigationSource navigationSource)
        {
            ExceptionUtils.CheckArgumentNotNull(configuration, "configuration");
            ExceptionUtils.CheckArgumentNotNull(edmType, "edmType");

            this.configuration = configuration;
            this.edmType = edmType;
            this.navigationSource = navigationSource;
        }
开发者ID:vebin,项目名称:odata.net,代码行数:15,代码来源:SelectExpandBinder.cs

示例9: EdmProperty

        /// <summary>
        /// Initializes a new instance of the <see cref="EdmProperty"/> class.
        /// </summary>
        /// <param name="declaringType">The type that declares this property.</param>
        /// <param name="name">Name of the property.</param>
        /// <param name="type">Type of the property.</param>
        protected EdmProperty(IEdmStructuredType declaringType, string name, IEdmTypeReference type)
            : base(name)
        {
            EdmUtil.CheckArgumentNull(declaringType, "declaringType");
            EdmUtil.CheckArgumentNull(type, "type");

            this.declaringType = declaringType;
            this.type = type;
        }
开发者ID:larsenjo,项目名称:odata.net,代码行数:15,代码来源:EdmProperty.cs

示例10: MetadataProviderEdmStructuralProperty

 /// <summary>
 /// Initializes a new instance of the <see cref="MetadataProviderEdmStructuralProperty"/> class.
 /// </summary>
 /// <param name="declaringType">The type that declares this property.</param>
 /// <param name="resourceProperty">The resource-property this edm property is based on.</param>
 /// <param name="type">The type of the property.</param>
 /// <param name="defaultValue">The default value of this property.</param>
 /// <param name="concurrencyMode">The concurrency mode of this property.</param>
 public MetadataProviderEdmStructuralProperty(
     IEdmStructuredType declaringType,
     ResourceProperty resourceProperty,
     IEdmTypeReference type, 
     string defaultValue,
     EdmConcurrencyMode concurrencyMode)
     : base(declaringType, resourceProperty.Name, type, defaultValue, concurrencyMode)
 {
     this.ResourceProperty = resourceProperty;
 }
开发者ID:larsenjo,项目名称:odata.net,代码行数:18,代码来源:MetadataProviderEdmStructuralProperty.cs

示例11: EdmStructuredObject

        /// <summary>
        /// Initializes a new instance of the <see cref="EdmStructuredObject"/> class.
        /// </summary>
        /// <param name="edmType">The <see cref="IEdmStructuredTypeReference"/> of this object.</param>
        /// <param name="isNullable">true if this object can be nullable; otherwise, false.</param>
        protected EdmStructuredObject(IEdmStructuredType edmType, bool isNullable)
        {
            if (edmType == null)
            {
                throw Error.ArgumentNull("edmType");
            }

            _expectedEdmType = edmType;
            _actualEdmType = edmType;
            IsNullable = isNullable;
        }
开发者ID:ZhaoYngTest01,项目名称:WebApi,代码行数:16,代码来源:EdmStructuredObject.cs

示例12: ValidatePropertyDefined

        /// <summary>
        /// Validates that a property with the specified name exists on a given structured type.
        /// The structured type can be null if no metadata is available.
        /// </summary>
        /// <param name="propertyName">The name of the property to validate.</param>
        /// <param name="owningStructuredType">The owning type of the property with name <paramref name="propertyName"/> 
        /// or null if no metadata is available.</param>
        /// <param name="throwOnMissingProperty">Whether throw exception on missing property.</param>
        /// <returns>The <see cref="IEdmProperty"/> instance representing the property with name <paramref name="propertyName"/> 
        /// or null if no metadata is available.</returns>
        public IEdmProperty ValidatePropertyDefined(
            string propertyName,
            IEdmStructuredType owningStructuredType,
            bool throwOnMissingProperty = true)
        {
            if (owningStructuredType == null)
            {
                return null;
            }

            return owningStructuredType.FindProperty(propertyName);
        }
开发者ID:TomDu,项目名称:odata.net,代码行数:22,代码来源:WriterValidatorMinimalValidation.cs

示例13: BadProperty

		public BadProperty(IEdmStructuredType declaringType, string name, IEnumerable<EdmError> errors) : base(errors)
		{
			this.type = new Cache<BadProperty, IEdmTypeReference>();
			string str = name;
			string empty = str;
			if (str == null)
			{
				empty = string.Empty;
			}
			this.name = empty;
			this.declaringType = declaringType;
		}
开发者ID:nickchal,项目名称:pash,代码行数:12,代码来源:BadProperty.cs

示例14: FindDefinedProperty

 internal static IEdmProperty FindDefinedProperty(string propertyName, IEdmStructuredType owningStructuredType, ODataMessageReaderSettings messageReaderSettings)
 {
     if (owningStructuredType == null)
     {
         return null;
     }
     IEdmProperty property = owningStructuredType.FindProperty(propertyName);
     if (((property == null) && owningStructuredType.IsOpen) && (messageReaderSettings.UndeclaredPropertyBehaviorKinds != ODataUndeclaredPropertyBehaviorKinds.None))
     {
         throw new ODataException(Microsoft.Data.OData.Strings.ReaderValidationUtils_UndeclaredPropertyBehaviorKindSpecifiedForOpenType(propertyName, owningStructuredType.ODataFullName()));
     }
     return property;
 }
开发者ID:nickchal,项目名称:pash,代码行数:13,代码来源:ReaderValidationUtils.cs

示例15: CreateDetailInfo

        private IEdmEntityObject CreateDetailInfo(int id, string title, IEdmStructuredType edmType)
        {
            IEdmNavigationProperty navigationProperty = edmType.DeclaredProperties.OfType<EdmNavigationProperty>().FirstOrDefault(e => e.Name == "DetailInfo");
            if (navigationProperty == null)
            {
                return null;
            }

            EdmEntityObject entity = new EdmEntityObject(navigationProperty.ToEntityType());
            entity.TrySetPropertyValue("ID", id);
            entity.TrySetPropertyValue("Title", title);
            return entity;
        }
开发者ID:chinadragon0515,项目名称:ODataSamples,代码行数:13,代码来源:MyDataSource.cs


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