StorageComplexPropertyMapping.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / DataEntity / System / Data / Mapping / StorageComplexPropertyMapping.cs / 1305376 / StorageComplexPropertyMapping.cs

                            //---------------------------------------------------------------------- 
// 
//      Copyright (c) Microsoft Corporation.  All rights reserved.
// 
// 
// @owner       [....]
// @backupOwner [....] 
//--------------------------------------------------------------------- 

using System; 
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Text;
using System.Data.Metadata.Edm; 

namespace System.Data.Mapping { 
    ///  
    /// Mapping metadata for Complex properties.
    ///  
    /// 
    /// For Example if conceptually you could represent the CS MSL file as following
    /// --Mapping
    ///   --EntityContainerMapping ( CNorthwind-->SNorthwind ) 
    ///     --EntitySetMapping
    ///       --EntityTypeMapping 
    ///         --TableMappingFragment 
    ///           --EntityKey
    ///             --ScalarPropertyMap ( CMemberMetadata-->SMemberMetadata ) 
    ///           --ScalarPropertyMap ( CMemberMetadata-->SMemberMetadata )
    ///       --EntityTypeMapping
    ///         --TableMappingFragment
    ///           --EntityKey 
    ///             --ScalarPropertyMap ( CMemberMetadata-->SMemberMetadata )
    ///           --ComplexPropertyMap 
    ///             --ComplexTypeMapping 
    ///               --ScalarPropertyMap ( CMemberMetadata-->SMemberMetadata )
    ///               --ScalarProperyMap ( CMemberMetadata-->SMemberMetadata ) 
    ///               --DiscriminatorProperyMap ( constant value-->SMemberMetadata )
    ///             --ComplexTypeMapping
    ///               --ScalarPropertyMap ( CMemberMetadata-->SMemberMetadata )
    ///               --ScalarProperyMap ( CMemberMetadata-->SMemberMetadata ) 
    ///               --DiscriminatorProperyMap ( constant value-->SMemberMetadata )
    ///           --ScalarPropertyMap ( CMemberMetadata-->SMemberMetadata ) 
    ///     --AssociationSetMapping 
    ///       --AssociationTypeMapping
    ///         --TableMappingFragment 
    ///           --EndPropertyMap
    ///             --ScalarPropertyMap ( CMemberMetadata-->SMemberMetadata )
    ///             --ScalarProperyMap ( CMemberMetadata-->SMemberMetadata )
    ///           --EndPropertyMap 
    ///             --ScalarPropertyMap ( CMemberMetadata-->SMemberMetadata )
    ///   --EntityContainerMapping ( CMyDatabase-->SMyDatabase ) 
    ///     --CompositionSetMapping 
    ///       --CompositionTypeMapping
    ///         --TableMappingFragment 
    ///           --ParentEntityKey
    ///             --ScalarPropertyMap ( CMemberMetadata-->SMemberMetadata )
    ///             --ScalarPropertyMap ( CMemberMetadata-->SMemberMetadata )
    ///           --EntityKey 
    ///             --ScalarPropertyMap ( CMemberMetadata-->SMemberMetadata )
    ///             --ScalarPropertyMap ( CMemberMetadata-->Constant value ) 
    ///           --ComplexPropertyMap 
    ///             --ComplexTypeMapping
    ///               --ScalarPropertyMap ( CMemberMetadata-->SMemberMetadata ) 
    ///               --ScalarProperyMap ( CMemberMetadata-->SMemberMetadata )
    ///           --ScalarPropertyMap ( CMemberMetadata-->Constant value )
    /// This class represents the metadata for all the complex property map elements in the
    /// above example. ComplexPropertyMaps contain ComplexTypeMaps which define mapping based 
    /// on the type of the ComplexProperty in case of inheritance.
    ///  
    internal class StorageComplexPropertyMapping : StoragePropertyMapping { 
        #region Constructors
        ///  
        /// Construct a new Complex Property mapping object
        /// 
        /// The MemberMetadata object that represents this Complex member
        internal StorageComplexPropertyMapping(EdmProperty cdmMember) 
            : base(cdmMember) {
            this.m_typeMappings = new List(); 
        } 
        #endregion
 
        #region Fields
        private List m_typeMappings;  //Set of type mappings that make up the EdmProperty mapping
        #endregion
 
        #region Properties
        /////  
        ///// The property Metadata object for which the mapping is represented. 
        ///// 
        //internal EdmProperty ComplexProperty { 
        //    get {
        //        return this.EdmProperty;
        //    }
        //} 

        ///  
        /// TypeMappings that make up this property. 
        /// 
        internal ReadOnlyCollection TypeMappings 
        {
            get
            {
                return this.m_typeMappings.AsReadOnly(); 
            }
        } 
        #endregion 

        #region Methods 
        /// 
        /// Add type mapping as a child under this Property Mapping
        /// 
        ///  
        internal void AddTypeMapping(StorageComplexTypeMapping typeMapping)
        { 
            this.m_typeMappings.Add(typeMapping); 
        }
 
        /// 
        /// This method is primarily for debugging purposes.
        /// Will be removed shortly.
        ///  
        /// 
        internal override void Print(int index) { 
            StorageEntityContainerMapping.GetPrettyPrintString(ref index); 
            StringBuilder sb = new StringBuilder();
            sb.Append("ComplexPropertyMapping"); 
            sb.Append("   ");
            if (this.EdmProperty != null) {
                sb.Append("Name:");
                sb.Append(this.EdmProperty.Name); 
                sb.Append("   ");
            } 
            Console.WriteLine(sb.ToString()); 
            foreach (StorageComplexTypeMapping typeMapping in TypeMappings)
            { 
                typeMapping.Print(index + 5);
            }

        } 
        #endregion
    } 
} 

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//---------------------------------------------------------------------- 
// 
//      Copyright (c) Microsoft Corporation.  All rights reserved.
// 
// 
// @owner       [....]
// @backupOwner [....] 
//--------------------------------------------------------------------- 

using System; 
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Text;
using System.Data.Metadata.Edm; 

namespace System.Data.Mapping { 
    ///  
    /// Mapping metadata for Complex properties.
    ///  
    /// 
    /// For Example if conceptually you could represent the CS MSL file as following
    /// --Mapping
    ///   --EntityContainerMapping ( CNorthwind-->SNorthwind ) 
    ///     --EntitySetMapping
    ///       --EntityTypeMapping 
    ///         --TableMappingFragment 
    ///           --EntityKey
    ///             --ScalarPropertyMap ( CMemberMetadata-->SMemberMetadata ) 
    ///           --ScalarPropertyMap ( CMemberMetadata-->SMemberMetadata )
    ///       --EntityTypeMapping
    ///         --TableMappingFragment
    ///           --EntityKey 
    ///             --ScalarPropertyMap ( CMemberMetadata-->SMemberMetadata )
    ///           --ComplexPropertyMap 
    ///             --ComplexTypeMapping 
    ///               --ScalarPropertyMap ( CMemberMetadata-->SMemberMetadata )
    ///               --ScalarProperyMap ( CMemberMetadata-->SMemberMetadata ) 
    ///               --DiscriminatorProperyMap ( constant value-->SMemberMetadata )
    ///             --ComplexTypeMapping
    ///               --ScalarPropertyMap ( CMemberMetadata-->SMemberMetadata )
    ///               --ScalarProperyMap ( CMemberMetadata-->SMemberMetadata ) 
    ///               --DiscriminatorProperyMap ( constant value-->SMemberMetadata )
    ///           --ScalarPropertyMap ( CMemberMetadata-->SMemberMetadata ) 
    ///     --AssociationSetMapping 
    ///       --AssociationTypeMapping
    ///         --TableMappingFragment 
    ///           --EndPropertyMap
    ///             --ScalarPropertyMap ( CMemberMetadata-->SMemberMetadata )
    ///             --ScalarProperyMap ( CMemberMetadata-->SMemberMetadata )
    ///           --EndPropertyMap 
    ///             --ScalarPropertyMap ( CMemberMetadata-->SMemberMetadata )
    ///   --EntityContainerMapping ( CMyDatabase-->SMyDatabase ) 
    ///     --CompositionSetMapping 
    ///       --CompositionTypeMapping
    ///         --TableMappingFragment 
    ///           --ParentEntityKey
    ///             --ScalarPropertyMap ( CMemberMetadata-->SMemberMetadata )
    ///             --ScalarPropertyMap ( CMemberMetadata-->SMemberMetadata )
    ///           --EntityKey 
    ///             --ScalarPropertyMap ( CMemberMetadata-->SMemberMetadata )
    ///             --ScalarPropertyMap ( CMemberMetadata-->Constant value ) 
    ///           --ComplexPropertyMap 
    ///             --ComplexTypeMapping
    ///               --ScalarPropertyMap ( CMemberMetadata-->SMemberMetadata ) 
    ///               --ScalarProperyMap ( CMemberMetadata-->SMemberMetadata )
    ///           --ScalarPropertyMap ( CMemberMetadata-->Constant value )
    /// This class represents the metadata for all the complex property map elements in the
    /// above example. ComplexPropertyMaps contain ComplexTypeMaps which define mapping based 
    /// on the type of the ComplexProperty in case of inheritance.
    ///  
    internal class StorageComplexPropertyMapping : StoragePropertyMapping { 
        #region Constructors
        ///  
        /// Construct a new Complex Property mapping object
        /// 
        /// The MemberMetadata object that represents this Complex member
        internal StorageComplexPropertyMapping(EdmProperty cdmMember) 
            : base(cdmMember) {
            this.m_typeMappings = new List(); 
        } 
        #endregion
 
        #region Fields
        private List m_typeMappings;  //Set of type mappings that make up the EdmProperty mapping
        #endregion
 
        #region Properties
        /////  
        ///// The property Metadata object for which the mapping is represented. 
        ///// 
        //internal EdmProperty ComplexProperty { 
        //    get {
        //        return this.EdmProperty;
        //    }
        //} 

        ///  
        /// TypeMappings that make up this property. 
        /// 
        internal ReadOnlyCollection TypeMappings 
        {
            get
            {
                return this.m_typeMappings.AsReadOnly(); 
            }
        } 
        #endregion 

        #region Methods 
        /// 
        /// Add type mapping as a child under this Property Mapping
        /// 
        ///  
        internal void AddTypeMapping(StorageComplexTypeMapping typeMapping)
        { 
            this.m_typeMappings.Add(typeMapping); 
        }
 
        /// 
        /// This method is primarily for debugging purposes.
        /// Will be removed shortly.
        ///  
        /// 
        internal override void Print(int index) { 
            StorageEntityContainerMapping.GetPrettyPrintString(ref index); 
            StringBuilder sb = new StringBuilder();
            sb.Append("ComplexPropertyMapping"); 
            sb.Append("   ");
            if (this.EdmProperty != null) {
                sb.Append("Name:");
                sb.Append(this.EdmProperty.Name); 
                sb.Append("   ");
            } 
            Console.WriteLine(sb.ToString()); 
            foreach (StorageComplexTypeMapping typeMapping in TypeMappings)
            { 
                typeMapping.Print(index + 5);
            }

        } 
        #endregion
    } 
} 

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
                        

Link Menu

Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
This book is available now!
Buy at Amazon US or
Buy at Amazon UK