1 //---------------------------------------------------------------------
2 // <copyright file="StorageTypeMapping.cs" company="Microsoft">
3 // Copyright (c) Microsoft Corporation. All rights reserved.
8 //---------------------------------------------------------------------
11 using System.Collections.Generic;
12 using System.Collections.ObjectModel;
14 using System.Data.Metadata.Edm;
16 namespace System.Data.Mapping {
18 /// Represents the Mapping metadata for a type map 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
28 /// --ScalarPropertyMap
29 /// --ScalarPropertyMap
30 /// --EntityTypeMapping
33 /// --ScalarPropertyMap
34 /// --ComplexPropertyMap
35 /// --ScalarPropertyMap
36 /// --ScalarProperyMap
37 /// --ScalarPropertyMap
38 /// --AssociationSetMapping
39 /// --AssociationTypeMapping
42 /// --ScalarPropertyMap
43 /// --ScalarProperyMap
45 /// --ScalarPropertyMap
46 /// This class represents the metadata for all the Type map elements in the
47 /// above example namely EntityTypeMapping, AssociationTypeMapping and CompositionTypeMapping.
48 /// The TypeMapping elements contain TableMappingFragments which in turn contain the property maps.
50 internal abstract class StorageTypeMapping {
53 /// Construct the new StorageTypeMapping object.
55 /// <param name="setMapping">SetMapping that contains this type mapping </param>
56 internal StorageTypeMapping(StorageSetMapping setMapping) {
57 this.m_fragments = new List<StorageMappingFragment>();
58 this.m_setMapping = setMapping;
64 /// ExtentMap that contains this type mapping.
66 StorageSetMapping m_setMapping;
68 /// Set of fragments that make up the type Mapping.
70 List<StorageMappingFragment> m_fragments;
75 /// Mapping fragments that make up this set type
77 internal ReadOnlyCollection<StorageMappingFragment> MappingFragments
81 return this.m_fragments.AsReadOnly();
85 internal StorageSetMapping SetMapping
95 /// a list of TypeMetadata that this mapping holds true for.
97 internal abstract ReadOnlyCollection<EdmType> Types { get;}
100 /// a list of TypeMetadatas for which the mapping holds true for
101 /// not only the type specified but the sub-types of that type as well.
103 internal abstract ReadOnlyCollection<EdmType> IsOfTypes { get;}
108 /// Add a fragment mapping as child of this type mapping
110 /// <param name="fragment"></param>
111 internal void AddFragment(StorageMappingFragment fragment)
113 this.m_fragments.Add(fragment);
117 /// This method is primarily for debugging purposes.
118 /// Will be removed shortly.
120 /// <param name="index"></param>
121 internal abstract void Print(int index);