File: StorageAssociationSetMapping.cs

package info (click to toggle)
mono 6.14.1%2Bds2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,282,732 kB
  • sloc: cs: 11,182,461; xml: 2,850,281; ansic: 699,123; cpp: 122,919; perl: 58,604; javascript: 30,841; asm: 21,845; makefile: 19,602; sh: 10,973; python: 4,772; pascal: 925; sql: 859; sed: 16; php: 1
file content (105 lines) | stat: -rw-r--r-- 4,052 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
//---------------------------------------------------------------------
// <copyright file="StorageAssociationSetMapping.cs" company="Microsoft">
//      Copyright (c) Microsoft Corporation.  All rights reserved.
// </copyright>
//
// @owner       Microsoft
// @backupOwner Microsoft
//---------------------------------------------------------------------

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

namespace System.Data.Mapping {
    /// <summary>
    /// Represents the Mapping metadata for an AssociationSet in CS space.
    /// </summary>
    /// <example>
    /// For Example if conceptually you could represent the CS MSL file as following
    /// --Mapping 
    ///   --EntityContainerMapping ( CNorthwind-->SNorthwind )
    ///     --EntitySetMapping
    ///       --EntityTypeMapping
    ///         --MappingFragment
    ///       --EntityTypeMapping
    ///         --MappingFragment
    ///     --AssociationSetMapping 
    ///       --AssociationTypeMapping
    ///         --MappingFragment
    /// This class represents the metadata for the AssociationSetMapping elements in the
    /// above example. And it is possible to access the AssociationTypeMap underneath it.
    /// There will be only one TypeMap under AssociationSetMap.
    /// </example>
    internal class StorageAssociationSetMapping : StorageSetMapping {
        #region Constructors
        /// <summary>
        /// Construct a new AssociationSetMapping object
        /// </summary>
        /// <param name="extent">Represents the Association Set Metadata object. Will
        ///                      change this to Extent instead of MemberMetadata.</param>
        /// <param name="entityContainerMapping">The entityContainerMapping mapping that contains this Set mapping</param>
        internal StorageAssociationSetMapping(AssociationSet extent, StorageEntityContainerMapping entityContainerMapping)
            : base(extent, entityContainerMapping) {
        }
        #endregion

        #region Fields
        private StorageAssociationSetModificationFunctionMapping m_modificationFunctionMapping;
        #endregion

        #region Properties
        /// <summary>
        /// Gets or sets function mapping information for this association set. May be null.
        /// </summary>
        internal StorageAssociationSetModificationFunctionMapping ModificationFunctionMapping {
            get { return m_modificationFunctionMapping; }
            set { m_modificationFunctionMapping = value; }
        }

        internal EntitySetBase StoreEntitySet
        {
            get
            {
                if ((this.TypeMappings.Count != 0) && (this.TypeMappings.First().MappingFragments.Count != 0))
                {
                    return this.TypeMappings.First().MappingFragments.First().TableSet;
                }
                return null;
            }
        }
        #endregion

        #region Methods
        /// <summary>
        /// This method is primarily for debugging purposes.
        /// Will be removed shortly.
        /// </summary>
        /// <param name="index"></param>
        internal override void Print(int index) {
            StorageEntityContainerMapping.GetPrettyPrintString(ref index);
            StringBuilder sb = new StringBuilder();
            sb.Append("AssociationSetMapping");
            sb.Append("   ");
            sb.Append("Name:");
            sb.Append(this.Set.Name);
            if (this.QueryView != null)
            {
                sb.Append("   ");
                sb.Append("Query View:");
                sb.Append(this.QueryView);
            }
            Console.WriteLine(sb.ToString());
            foreach (StorageTypeMapping typeMapping in TypeMappings) {
                typeMapping.Print(index + 5);
            }
            if(m_modificationFunctionMapping != null)
            {
                m_modificationFunctionMapping.Print(index + 5);
            }
        }
        #endregion
    }
}