src/Misc/EFTools/EntityDesignEntityDesigner/GeneratedCode/Shapes.cs
/// <summary>
/// Gets an array of CompartmentMappings for all compartments displayed on this shape
/// (including compartment maps defined on base shapes). 
/// </summary>
/// <param name="melType">The type of the DomainClass that this shape is mapped to</param>
/// <returns></returns>
Gets an array of CompartmentMappings for all compartments displayed on this shape
(including compartment maps defined on base shapes).
Gets an array of CompartmentMappings for all compartments displayed on this shape ( including compartment maps defined on base shapes ) .
protected override DslDiagrams::CompartmentMapping[] GetCompartmentMappings(global::System.Type melType)
		{
			if(melType==null) throw new global::System.ArgumentNullException("melType");
			if(compartmentMappings==null)
			{
				compartmentMappings = new global::System.Collections.Generic.Dictionary<global::System.Type, DslDiagrams::CompartmentMapping[]>();
				{
					DslDiagrams::CompartmentMapping[] baseMappings = base.GetCompartmentMappings(typeof(global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.EntityType));
					int localCompartmentMappingsOffset = 0;
					if(baseMappings!=null)
					{
						localCompartmentMappingsOffset = baseMappings.Length;
					}
					DslDiagrams::CompartmentMapping[] mappings = new DslDiagrams::CompartmentMapping[2+localCompartmentMappingsOffset];
					if(baseMappings!=null)
					{
						baseMappings.CopyTo(mappings, 0);
					}
					mappings[localCompartmentMappingsOffset+0] = new DslDiagrams::ElementListCompartmentMapping(
																				"Navigation", 
																				global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.NameableItem.NameDomainPropertyId, 
																				global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.NavigationProperty.DomainClassId, 
																				GetElementsFromEntityTypeForNavigation,
																				null,
																				null,
																				null);
					 static string GetDisplayPropertyFromEntityTypeForProperties(DslModeling::ModelElement element)
					mappings[localCompartmentMappingsOffset+1] = new DslDiagrams::ElementListCompartmentMapping(
																				"Properties", 
																				global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.NameableItem.NameDomainPropertyId, 
																				global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.Property.DomainClassId, 
																				GetElementsFromEntityTypeForProperties,
																				null,
																				GetDisplayPropertyFromEntityTypeForProperties,	 This method needs to be provided. Please see comment-block above.
																				null);
					compartmentMappings.Add(typeof(global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.EntityType), mappings);
				}
			}
			 See if we can find the mapping being requested directly in the table. 
			DslDiagrams::CompartmentMapping[] returnValue;
			if(compartmentMappings.TryGetValue(melType, out returnValue))
			{
				return returnValue;
			}
			 If not, loop through the types in the table, and find the 'most derived' base
			 class of melType. 
			global::System.Type selectedMappedType = null;
			foreach(global::System.Type mappedType in compartmentMappings.Keys)
			{
				if(mappedType.IsAssignableFrom(melType) && (selectedMappedType==null || selectedMappedType.IsAssignableFrom(mappedType)))
				{
					selectedMappedType = mappedType;
				}
			}
			if(selectedMappedType!=null)
			{
				return compartmentMappings[selectedMappedType];
			}
			return new DslDiagrams::CompartmentMapping[] {};
		}
protected override DslDiagrams :: CompartmentMapping [ ] GetCompartmentMappings ( global :: System . Type melType ) { if ( melType == null ) throw new global :: System . ArgumentNullException ( " " ) ; if ( compartmentMappings == null ) { compartmentMappings = new global :: System . Collections . Generic . Dictionary < global :: System . Type , DslDiagrams :: CompartmentMapping [ ] > ( ) ; { DslDiagrams :: CompartmentMapping [ ] baseMappings = base . GetCompartmentMappings ( typeof ( global :: Microsoft . Data . Entity . Design . EntityDesigner . ViewModel . EntityType ) ) ; int localCompartmentMappingsOffset = 0 ; if ( baseMappings != null ) { localCompartmentMappingsOffset = baseMappings . Length ; } DslDiagrams :: CompartmentMapping [ ] mappings = new DslDiagrams :: CompartmentMapping [ 2 + localCompartmentMappingsOffset ] ; if ( baseMappings != null ) { baseMappings . CopyTo ( mappings , 0 ) ; } mappings [ localCompartmentMappingsOffset + 0 ] = new DslDiagrams :: ElementListCompartmentMapping ( " " , global :: Microsoft . Data . Entity . Design . EntityDesigner . ViewModel . NameableItem . NameDomainPropertyId , global :: Microsoft . Data . Entity . Design . EntityDesigner . ViewModel . NavigationProperty . DomainClassId , GetElementsFromEntityTypeForNavigation , null , null , null ) ; mappings [ localCompartmentMappingsOffset + 1 ] = new DslDiagrams :: ElementListCompartmentMapping ( " " , global :: Microsoft . Data . Entity . Design . EntityDesigner . ViewModel . NameableItem . NameDomainPropertyId , global :: Microsoft . Data . Entity . Design . EntityDesigner . ViewModel . Property . DomainClassId , GetElementsFromEntityTypeForProperties , null , GetDisplayPropertyFromEntityTypeForProperties , null ) ; compartmentMappings . Add ( typeof ( global :: Microsoft . Data . Entity . Design . EntityDesigner . ViewModel . EntityType ) , mappings ) ; } } DslDiagrams :: CompartmentMapping [ ] returnValue ; if ( compartmentMappings . TryGetValue ( melType , out returnValue ) ) { return returnValue ; } global :: System . Type selectedMappedType = null ; foreach ( global :: System . Type mappedType in compartmentMappings . Keys ) { if ( mappedType . IsAssignableFrom ( melType ) && ( selectedMappedType == null || selectedMappedType . IsAssignableFrom ( mappedType ) ) ) { selectedMappedType = mappedType ; } } if ( selectedMappedType != null ) { return compartmentMappings [ selectedMappedType ] ; } return new DslDiagrams :: CompartmentMapping [ ] { } ; }
Gets an array of CompartmentMappings for all compartments displayed on this shape
(including compartment maps defined on base shapes).
Gets an array of CompartmentMappings for all compartments displayed on this shape ( including compartment maps defined on base shapes ) .
// Initialize the table of compartment mappings if we haven't done so already.  // The table contains an array of CompartmentMapping for every Type that this // shape can be mapped to.  // First we get the mappings defined for the base shape, and add on any mappings defined for this // shape.  //////// // CompartmentMap.DisplaysCustomString == true // Please provide the following method to get the string to be // displayed in the compartment list:  // // static string GetDisplayPropertyFromEntityTypeForProperties(DslModeling::ModelElement element) //////// // This method needs to be provided. Please see comment-block above. // See if we can find the mapping being requested directly in the table.  // If not, loop through the types in the table, and find the 'most derived' base // class of melType. 
None
melType
global::System.Type
The type of the DomainClass that this shape is mapped to
The type of the DomainClass that this shape is mapped to