StorageScalarPropertyMapping.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / ndp / fx / src / DataEntity / System / Data / Mapping / StorageScalarPropertyMapping.cs / 1 / StorageScalarPropertyMapping.cs

                            //---------------------------------------------------------------------- 
// 
//      Copyright (c) Microsoft Corporation.  All rights reserved.
// 
// 
// @owner  	 [....]
// @backupOwner [....] 
//--------------------------------------------------------------------- 
using System;
using System.Diagnostics; 
using System.Collections.Generic;
using System.Text;
using System.Data.Metadata.Edm;
using System.Data.Mapping.ViewGeneration.Utils; 

namespace System.Data.Mapping { 
    ///  
    /// Mapping metadata for scalar 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 
    ///             --ScalarPropertyMap ( CMemberMetadata-->SMemberMetadata ) 
    ///             --ScalarProperyMap ( CMemberMetadata-->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
    ///             --ScalarPropertyMap ( CMemberMetadata-->SMemberMetadata )
    ///             --ScalarProperyMap ( CMemberMetadata-->SMemberMetadata )
    ///           --ScalarPropertyMap ( CMemberMetadata-->Constant value ) 
    /// This class represents the metadata for all the scalar property map elements in the
    /// above example. 
    ///  
    internal class StorageScalarPropertyMapping : StoragePropertyMapping {
        #region Constructors 
        /// 
        /// Construct a new Scalar EdmProperty mapping object
        /// 
        ///  
        /// 
        internal StorageScalarPropertyMapping(EdmProperty member, EdmProperty columnMember) 
            : base(member) { 
            Debug.Assert(columnMember != null);
            Debug.Assert(Helper.IsPrimitiveType(member.TypeUsage.EdmType), "StorageScalarPropertyMapping must only map primitive types"); 
            Debug.Assert(Helper.IsPrimitiveType(columnMember.TypeUsage.EdmType), "StorageScalarPropertyMapping must only map primitive types");
            this.m_columnMember = columnMember;
        }
        #endregion 

        #region Fields 
        EdmProperty m_columnMember;  //S-side member for which the sclar property is being mapped 
        //This will be interpreted by the view generation algorithm based on the context
        #endregion 


        #region Properties
        ///  
        /// column name from which the sclar property is being mapped
        ///  
        internal EdmProperty ColumnProperty 
        {
            get { 
                return this.m_columnMember;
            }
        }
        #endregion 

        #region Methods 
        ///  
        /// 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("ScalarPropertyMapping"); 
            sb.Append("   "); 
            if (this.EdmProperty != null) {
                sb.Append("Name:"); 
                sb.Append(this.EdmProperty.Name);
                sb.Append("   ");
            }
            if (this.ColumnProperty != null) { 
                sb.Append("Column Name:");
                sb.Append(this.ColumnProperty.Name); 
            } 
            Console.WriteLine(sb.ToString());
        } 
        #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.Diagnostics; 
using System.Collections.Generic;
using System.Text;
using System.Data.Metadata.Edm;
using System.Data.Mapping.ViewGeneration.Utils; 

namespace System.Data.Mapping { 
    ///  
    /// Mapping metadata for scalar 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 
    ///             --ScalarPropertyMap ( CMemberMetadata-->SMemberMetadata ) 
    ///             --ScalarProperyMap ( CMemberMetadata-->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
    ///             --ScalarPropertyMap ( CMemberMetadata-->SMemberMetadata )
    ///             --ScalarProperyMap ( CMemberMetadata-->SMemberMetadata )
    ///           --ScalarPropertyMap ( CMemberMetadata-->Constant value ) 
    /// This class represents the metadata for all the scalar property map elements in the
    /// above example. 
    ///  
    internal class StorageScalarPropertyMapping : StoragePropertyMapping {
        #region Constructors 
        /// 
        /// Construct a new Scalar EdmProperty mapping object
        /// 
        ///  
        /// 
        internal StorageScalarPropertyMapping(EdmProperty member, EdmProperty columnMember) 
            : base(member) { 
            Debug.Assert(columnMember != null);
            Debug.Assert(Helper.IsPrimitiveType(member.TypeUsage.EdmType), "StorageScalarPropertyMapping must only map primitive types"); 
            Debug.Assert(Helper.IsPrimitiveType(columnMember.TypeUsage.EdmType), "StorageScalarPropertyMapping must only map primitive types");
            this.m_columnMember = columnMember;
        }
        #endregion 

        #region Fields 
        EdmProperty m_columnMember;  //S-side member for which the sclar property is being mapped 
        //This will be interpreted by the view generation algorithm based on the context
        #endregion 


        #region Properties
        ///  
        /// column name from which the sclar property is being mapped
        ///  
        internal EdmProperty ColumnProperty 
        {
            get { 
                return this.m_columnMember;
            }
        }
        #endregion 

        #region Methods 
        ///  
        /// 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("ScalarPropertyMapping"); 
            sb.Append("   "); 
            if (this.EdmProperty != null) {
                sb.Append("Name:"); 
                sb.Append(this.EdmProperty.Name);
                sb.Append("   ");
            }
            if (this.ColumnProperty != null) { 
                sb.Append("Column Name:");
                sb.Append(this.ColumnProperty.Name); 
            } 
            Console.WriteLine(sb.ToString());
        } 
        #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