/// <summary> /// Creates instance of EntityPropertyMappingInfo class. /// </summary> /// <param name="attribute">The <see cref="EntityPropertyMappingAttribute"/> corresponding to this object</param> /// <param name="definingType">Type the <see cref="EntityPropertyMappingAttribute"/> was defined on.</param> /// <param name="actualTypeDeclaringProperty">Type whose property is to be read. This can be different from defining type when inheritance is involved.</param> internal EntityPropertyMappingInfo(EntityPropertyMappingAttribute attribute, ResourceType definingType, ResourceType actualTypeDeclaringProperty) { DebugUtils.CheckNoExternalCallers(); Debug.Assert(attribute != null, "attribute != null"); Debug.Assert(definingType != null, "definingType != null"); Debug.Assert(actualTypeDeclaringProperty != null, "actualTypeDeclaringProperty != null"); this.attribute = attribute; this.definingType = definingType; this.actualPropertyType = actualTypeDeclaringProperty; this.multiValueStatus = EntityPropertyMappingMultiValueStatus.None; this.CriteriaValue = attribute.CriteriaValue; // Infer the mapping type from the attribute this.isSyndicationMapping = this.attribute.TargetSyndicationItem != SyndicationItemProperty.CustomProperty; switch (this.attribute.TargetSyndicationItem) { case SyndicationItemProperty.AuthorEmail: case SyndicationItemProperty.AuthorName: case SyndicationItemProperty.AuthorUri: this.SyndicationParent = EpmSyndicationParent.Author; break; case SyndicationItemProperty.CategoryLabel: case SyndicationItemProperty.CategoryScheme: case SyndicationItemProperty.CategoryTerm: this.SyndicationParent = EpmSyndicationParent.Category; break; case SyndicationItemProperty.ContributorEmail: case SyndicationItemProperty.ContributorName: case SyndicationItemProperty.ContributorUri: this.SyndicationParent = EpmSyndicationParent.Contributor; break; case SyndicationItemProperty.LinkHref: case SyndicationItemProperty.LinkHrefLang: case SyndicationItemProperty.LinkLength: case SyndicationItemProperty.LinkRel: case SyndicationItemProperty.LinkTitle: case SyndicationItemProperty.LinkType: this.SyndicationParent = EpmSyndicationParent.Link; break; default: this.SyndicationParent = EpmSyndicationParent.Entry; break; } if (attribute.CriteriaValue != null) { if (this.SyndicationParent == EpmSyndicationParent.Category) { this.Criteria = EpmSyndicationCriteria.CategoryScheme; } else if (this.SyndicationParent == EpmSyndicationParent.Link) { this.Criteria = EpmSyndicationCriteria.LinkRel; } else { this.Criteria = EpmSyndicationCriteria.None; } } }
/// <summary> /// Creates instance of EntityPropertyMappingInfo class. /// </summary> /// <param name="attribute">The <see cref="EntityPropertyMappingAttribute"/> corresponding to this object</param> /// <param name="definingType">Type the <see cref="EntityPropertyMappingAttribute"/> was defined on.</param> /// <param name="actualTypeDeclaringProperty">Type whose property is to be read. This can be different from defining type when inheritance is involved.</param> internal EntityPropertyMappingInfo(EntityPropertyMappingAttribute attribute, ResourceType definingType, ResourceType actualTypeDeclaringProperty) { DebugUtils.CheckNoExternalCallers(); Debug.Assert(attribute != null, "attribute != null"); Debug.Assert(definingType != null, "definingType != null"); Debug.Assert(actualTypeDeclaringProperty != null, "actualTypeDeclaringProperty != null"); this.attribute = attribute; this.definingType = definingType; this.actualPropertyType = actualTypeDeclaringProperty; this.multiValueStatus = EntityPropertyMappingMultiValueStatus.None; this.CriteriaValue = attribute.CriteriaValue; // Infer the mapping type from the attribute this.isSyndicationMapping = this.attribute.TargetSyndicationItem != SyndicationItemProperty.CustomProperty; switch (this.attribute.TargetSyndicationItem) { case SyndicationItemProperty.AuthorEmail: case SyndicationItemProperty.AuthorName: case SyndicationItemProperty.AuthorUri: this.SyndicationParent = EpmSyndicationParent.Author; break; case SyndicationItemProperty.CategoryLabel: case SyndicationItemProperty.CategoryScheme: case SyndicationItemProperty.CategoryTerm: this.SyndicationParent = EpmSyndicationParent.Category; break; case SyndicationItemProperty.ContributorEmail: case SyndicationItemProperty.ContributorName: case SyndicationItemProperty.ContributorUri: this.SyndicationParent = EpmSyndicationParent.Contributor; break; case SyndicationItemProperty.LinkHref: case SyndicationItemProperty.LinkHrefLang: case SyndicationItemProperty.LinkLength: case SyndicationItemProperty.LinkRel: case SyndicationItemProperty.LinkTitle: case SyndicationItemProperty.LinkType: this.SyndicationParent = EpmSyndicationParent.Link; break; default: this.SyndicationParent = EpmSyndicationParent.Entry; break; } if (attribute.CriteriaValue != null) { if (this.SyndicationParent == EpmSyndicationParent.Category) { this.Criteria = EpmSyndicationCriteria.CategoryScheme; } else if (this.SyndicationParent == EpmSyndicationParent.Link) { this.Criteria = EpmSyndicationCriteria.LinkRel; } else { this.Criteria = EpmSyndicationCriteria.None; } } }