protected EpmContentSerializerBase(EpmTargetTree tree, bool isSyndication, object element, XmlWriter target)
 {
     this.Root = isSyndication ? tree.SyndicationRoot : tree.NonSyndicationRoot;
     this.Element = element;
     this.Target = target;
     this.Success = false;
 }
 protected EpmContentSerializerBase(EpmTargetTree tree, bool isSyndication, object element, XmlWriter target)
 {
     this.Root    = isSyndication ? tree.SyndicationRoot : tree.NonSyndicationRoot;
     this.Element = element;
     this.Target  = target;
     this.Success = false;
 }
 /// <summary>
 /// Constructor initializes the base class be identifying itself as a custom content serializer
 /// </summary>
 /// <param name="targetTree">Target tree containing mapping information</param>
 /// <param name="element">Object to be serialized</param>
 /// <param name="target">SyndicationItem to which content will be added</param>
 /// <param name="nullValuedProperties">Null valued properties found during serialization</param>
 /// <param name="provider">Data Service provider used for rights verification.</param>
 internal EpmCustomContentSerializer(EpmTargetTree targetTree, object element, SyndicationItem target, EpmContentSerializer.EpmNullValuedPropertyTree nullValuedProperties, DataServiceProviderWrapper provider)
     : base(targetTree, false, element, target)
 {
     this.InitializeVisitorContent(nullValuedProperties, provider);
 }
 /// <summary>
 /// Constructor initializes the base class be identifying itself as a custom content serializer
 /// </summary>
 /// <param name="targetTree">Target tree containing mapping information</param>
 /// <param name="element">Object to be serialized</param>
 /// <param name="target">SyndicationItem to which content will be added</param>
 internal EpmCustomContentSerializer(EpmTargetTree targetTree, object element, XmlWriter target)
     : base(targetTree, false, element, target)
 {
     this.InitializeVisitorContent();
 }
Beispiel #5
0
 internal EpmSourceTree(EpmTargetTree epmTargetTree)
 {
     this.root          = new EpmSourcePathSegment("");
     this.epmTargetTree = epmTargetTree;
 }
 /// <summary>
 /// Constructor initializes the base class be identifying itself as a custom content serializer
 /// </summary>
 /// <param name="targetTree">Target tree containing mapping information</param>
 /// <param name="element">Object to be serialized</param>
 /// <param name="target">SyndicationItem to which content will be added</param>
 /// <param name="nullValuedProperties">Null valued properties found during serialization</param>
 /// <param name="provider">Data Service provider used for rights verification.</param>
 internal EpmCustomContentSerializer(EpmTargetTree targetTree, object element, SyndicationItem target, EpmContentSerializer.EpmNullValuedPropertyTree nullValuedProperties, DataServiceProviderWrapper provider)
     : base(targetTree, false, element, target)
 {
     this.InitializeVisitorContent(nullValuedProperties, provider);
 }
 /// <summary>
 /// Constructor initializes the base class be identifying itself as a custom content serializer
 /// </summary>
 /// <param name="targetTree">Target tree containing mapping information</param>
 /// <param name="element">Object to be serialized</param>
 /// <param name="target">SyndicationItem to which content will be added</param>
 internal EpmCustomContentSerializer(EpmTargetTree targetTree, object element, XmlWriter target)
     : base(targetTree, false, element, target)
 {
     this.InitializeVisitorContent();
 }
Beispiel #8
0
        /// <summary>
        /// Constructor decided whether to use syndication or non-syndication sub-tree for target content mappings
        /// </summary>
        /// <param name="tree">Target tree containing mapping information</param>
        /// <param name="isSyndication">Helps in deciding whether to use syndication sub-tree or non-syndication one</param>
        /// <param name="element">Object to be serialized</param>
        /// <param name="target">SyndicationItem to which content will be added</param>
#if ASTORIA_CLIENT
        protected EpmContentSerializerBase(EpmTargetTree tree, bool isSyndication, object element, XmlWriter target)
			/// <summary>
			/// Removes all data created internally by ResourceType. This is needed when building epm
			/// info fails since the trees may be left in undefined state (i.e. half constructed) and 
			/// if inherited EPM attributes exist duplicates will be added.
			/// </summary> 
			internal void Reset()
			{
				this.epmTargetTree = null;
				this.epmSourceTree = null;
				this.inheritedEpmInfo = null;
			}
Beispiel #10
0
 /// <summary>Default constructor creates a null root</summary>
 /// <param name="epmTargetTree">Target xml tree</param>
 internal EpmSourceTree(EpmTargetTree epmTargetTree)
 {
     this.root = new EpmSourcePathSegment("");
     this.epmTargetTree = epmTargetTree;
 }
Beispiel #11
0
        internal void Add(EntityPropertyMappingInfo epmInfo)
        {
            String targetName      = epmInfo.Attribute.TargetPath;
            bool   isSyndication   = epmInfo.Attribute.TargetSyndicationItem != SyndicationItemProperty.CustomProperty;
            String namespaceUri    = epmInfo.Attribute.TargetNamespaceUri;
            String namespacePrefix = epmInfo.Attribute.TargetNamespacePrefix;

            EpmTargetPathSegment         currentSegment    = isSyndication ? this.SyndicationRoot : this.NonSyndicationRoot;
            IList <EpmTargetPathSegment> activeSubSegments = currentSegment.SubSegments;

            Debug.Assert(!String.IsNullOrEmpty(targetName), "Must have been validated during EntityPropertyMappingAttribute construction");
            String[] targetSegments = targetName.Split('/');

            for (int i = 0; i < targetSegments.Length; i++)
            {
                String targetSegment = targetSegments[i];

                if (targetSegment.Length == 0)
                {
                    throw new InvalidOperationException(Strings.EpmTargetTree_InvalidTargetPath(targetName));
                }

                if (targetSegment[0] == '@' && i != targetSegments.Length - 1)
                {
                    throw new InvalidOperationException(Strings.EpmTargetTree_AttributeInMiddle(targetSegment));
                }

                EpmTargetPathSegment foundSegment = activeSubSegments.SingleOrDefault(
                    segment => segment.SegmentName == targetSegment &&
                    (isSyndication || segment.SegmentNamespaceUri == namespaceUri));
                if (foundSegment != null)
                {
                    currentSegment = foundSegment;
                }
                else
                {
                    currentSegment = new EpmTargetPathSegment(targetSegment, namespaceUri, namespacePrefix, currentSegment);
                    if (targetSegment[0] == '@')
                    {
                        activeSubSegments.Insert(0, currentSegment);
                    }
                    else
                    {
                        activeSubSegments.Add(currentSegment);
                    }
                }

                activeSubSegments = currentSegment.SubSegments;
            }

            if (currentSegment.HasContent)
            {
                throw new ArgumentException(Strings.EpmTargetTree_DuplicateEpmAttrsWithSameTargetName(EpmTargetTree.GetPropertyNameFromEpmInfo(currentSegment.EpmInfo), currentSegment.EpmInfo.DefiningType.Name, currentSegment.EpmInfo.Attribute.SourcePath, epmInfo.Attribute.SourcePath));
            }

            if (!epmInfo.Attribute.KeepInContent)
            {
                this.countOfNonContentProperties++;
            }

            currentSegment.EpmInfo = epmInfo;

            if (EpmTargetTree.HasMixedContent(this.NonSyndicationRoot, false))
            {
                throw new InvalidOperationException(Strings.EpmTargetTree_InvalidTargetPath(targetName));
            }
        }
 protected EpmContentSerializerBase(EpmTargetTree tree, bool isSyndication, object element, XmlWriter target)
 /// <summary>
 /// Constructor initializes the base class be identifying itself as a syndication serializer
 /// </summary>
 /// <param name="tree">Target tree containing mapping information</param>
 /// <param name="element">Object to be serialized</param>
 /// <param name="target">SyndicationItem to which content will be added</param>
 /// <param name="nullValuedProperties">Null valued properties found during serialization</param>
 internal EpmSyndicationContentSerializer(EpmTargetTree tree, object element, SyndicationItem target, EpmContentSerializer.EpmNullValuedPropertyTree nullValuedProperties)
     : base(tree, true, element, target)
 {
     this.nullValuedProperties = nullValuedProperties;
 }
 internal EpmSyndicationContentSerializer(EpmTargetTree tree, object element, XmlWriter target)
     : base(tree, true, element, target)
 {
 }