1 //---------------------------------------------------------------------
2 // <copyright file="StorageAssociationSetMapping.cs" company="Microsoft">
3 // Copyright (c) Microsoft Corporation. All rights reserved.
7 // @backupOwner Microsoft
8 //---------------------------------------------------------------------
11 using System.Collections.Generic;
14 using System.Data.Metadata.Edm;
16 namespace System.Data.Mapping {
18 /// Represents the Mapping metadata for an AssociationSet in CS space.
21 /// For Example if conceptually you could represent the CS MSL file as following
23 /// --EntityContainerMapping ( CNorthwind-->SNorthwind )
24 /// --EntitySetMapping
25 /// --EntityTypeMapping
27 /// --EntityTypeMapping
29 /// --AssociationSetMapping
30 /// --AssociationTypeMapping
32 /// This class represents the metadata for the AssociationSetMapping elements in the
33 /// above example. And it is possible to access the AssociationTypeMap underneath it.
34 /// There will be only one TypeMap under AssociationSetMap.
36 internal class StorageAssociationSetMapping : StorageSetMapping {
39 /// Construct a new AssociationSetMapping object
41 /// <param name="extent">Represents the Association Set Metadata object. Will
42 /// change this to Extent instead of MemberMetadata.</param>
43 /// <param name="entityContainerMapping">The entityContainerMapping mapping that contains this Set mapping</param>
44 internal StorageAssociationSetMapping(AssociationSet extent, StorageEntityContainerMapping entityContainerMapping)
45 : base(extent, entityContainerMapping) {
50 private StorageAssociationSetModificationFunctionMapping m_modificationFunctionMapping;
55 /// Gets or sets function mapping information for this association set. May be null.
57 internal StorageAssociationSetModificationFunctionMapping ModificationFunctionMapping {
58 get { return m_modificationFunctionMapping; }
59 set { m_modificationFunctionMapping = value; }
62 internal EntitySetBase StoreEntitySet
66 if ((this.TypeMappings.Count != 0) && (this.TypeMappings.First().MappingFragments.Count != 0))
68 return this.TypeMappings.First().MappingFragments.First().TableSet;
77 /// This method is primarily for debugging purposes.
78 /// Will be removed shortly.
80 /// <param name="index"></param>
81 internal override void Print(int index) {
82 StorageEntityContainerMapping.GetPrettyPrintString(ref index);
83 StringBuilder sb = new StringBuilder();
84 sb.Append("AssociationSetMapping");
87 sb.Append(this.Set.Name);
88 if (this.QueryView != null)
91 sb.Append("Query View:");
92 sb.Append(this.QueryView);
94 Console.WriteLine(sb.ToString());
95 foreach (StorageTypeMapping typeMapping in TypeMappings) {
96 typeMapping.Print(index + 5);
98 if(m_modificationFunctionMapping != null)
100 m_modificationFunctionMapping.Print(index + 5);