StorageEndPropertyMapping.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / ndp / fx / src / DataEntity / System / Data / Mapping / StorageEndPropertyMapping.cs / 2 / StorageEndPropertyMapping.cs

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

using System; 
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text; 
using System.Data.Metadata.Edm;
 
namespace System.Data.Mapping { 
    /// 
    /// Mapping metadata for End property of an association. 
    /// 
    /// 
    /// 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 end property map elements in the 
    /// above example. EndPropertyMaps provide mapping for each end of the association.
    ///  
 
    internal class StorageEndPropertyMapping : StoragePropertyMapping {
        #region Constructors 
        /// 
        /// Construct a new End Property mapping object
        /// 
        ///  
        internal StorageEndPropertyMapping(EdmProperty member)
            : base(member) { 
        } 
        #endregion
 
        #region Fields
        Dictionary m_properties = new Dictionary(StringComparer.Ordinal);  //list of property mappings that make up the End
        RelationshipEndMember m_endMember = null;
        #endregion 

        #region Properties 
        ///  
        /// return ReadOnlyCollection of property mappings that are children of this End mapping
        ///  
        internal ReadOnlyCollection Properties {
            get {
                return new List(this.m_properties.Values).AsReadOnly();
            } 
        }
 
        ///  
        /// The relation end property Metadata object for which the mapping is represented.
        ///  
        internal RelationshipEndMember EndMember {
            get {
                return this.m_endMember;
            } 
            set {
                this.m_endMember = value; 
            } 
        }
 
        /// 
        /// Returns all store properties that are mapped under this mapping fragment
        /// 
        internal IEnumerable StoreProperties 
        {
            get 
            { 
                return m_properties.Values.OfType().Select((propertyMap => propertyMap.ColumnProperty)).Cast();
            } 
        }

        #endregion
 
        #region Methods
        ///  
        /// Add a property mapping as a child of End property mapping 
        /// 
        ///  
        internal void AddProperty(StoragePropertyMapping prop) {
            this.m_properties.Add(prop.EdmProperty.Name, prop);
        }
 
        /// 
        /// 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("EndPropertyMapping"); 
            sb.Append("   ");
            if (this.EndMember != null) { 
                sb.Append("Name:"); 
                sb.Append(this.EndMember.Name);
                sb.Append("   "); 
                sb.Append("TypeName:");
                sb.Append(this.EndMember.TypeUsage.EdmType.FullName);
            }
            sb.Append("   "); 
            Console.WriteLine(sb.ToString());
            foreach (StoragePropertyMapping propertyMapping in Properties) { 
                propertyMapping.Print(index + 5); 
            }
        } 
        #endregion
    }
}

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

using System; 
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text; 
using System.Data.Metadata.Edm;
 
namespace System.Data.Mapping { 
    /// 
    /// Mapping metadata for End property of an association. 
    /// 
    /// 
    /// 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 end property map elements in the 
    /// above example. EndPropertyMaps provide mapping for each end of the association.
    ///  
 
    internal class StorageEndPropertyMapping : StoragePropertyMapping {
        #region Constructors 
        /// 
        /// Construct a new End Property mapping object
        /// 
        ///  
        internal StorageEndPropertyMapping(EdmProperty member)
            : base(member) { 
        } 
        #endregion
 
        #region Fields
        Dictionary m_properties = new Dictionary(StringComparer.Ordinal);  //list of property mappings that make up the End
        RelationshipEndMember m_endMember = null;
        #endregion 

        #region Properties 
        ///  
        /// return ReadOnlyCollection of property mappings that are children of this End mapping
        ///  
        internal ReadOnlyCollection Properties {
            get {
                return new List(this.m_properties.Values).AsReadOnly();
            } 
        }
 
        ///  
        /// The relation end property Metadata object for which the mapping is represented.
        ///  
        internal RelationshipEndMember EndMember {
            get {
                return this.m_endMember;
            } 
            set {
                this.m_endMember = value; 
            } 
        }
 
        /// 
        /// Returns all store properties that are mapped under this mapping fragment
        /// 
        internal IEnumerable StoreProperties 
        {
            get 
            { 
                return m_properties.Values.OfType().Select((propertyMap => propertyMap.ColumnProperty)).Cast();
            } 
        }

        #endregion
 
        #region Methods
        ///  
        /// Add a property mapping as a child of End property mapping 
        /// 
        ///  
        internal void AddProperty(StoragePropertyMapping prop) {
            this.m_properties.Add(prop.EdmProperty.Name, prop);
        }
 
        /// 
        /// 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("EndPropertyMapping"); 
            sb.Append("   ");
            if (this.EndMember != null) { 
                sb.Append("Name:"); 
                sb.Append(this.EndMember.Name);
                sb.Append("   "); 
                sb.Append("TypeName:");
                sb.Append(this.EndMember.TypeUsage.EdmType.FullName);
            }
            sb.Append("   "); 
            Console.WriteLine(sb.ToString());
            foreach (StoragePropertyMapping propertyMapping in Properties) { 
                propertyMapping.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