//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

using DslModeling = global::Microsoft.VisualStudio.Modeling;
using DslDesign = global::Microsoft.VisualStudio.Modeling.Design;
using DslDiagrams = global::Microsoft.VisualStudio.Modeling.Diagrams;
namespace Microsoft.Data.Entity.Design.EntityDesigner
{
    /// <summary>
	/// DomainModel MicrosoftDataEntityDesignDomainModel
	/// ADO.NET Entity Framework Designer
	/// </summary>
	[DslDesign::DisplayNameResource("Microsoft.Data.Entity.Design.EntityDesigner.MicrosoftDataEntityDesignDomainModel.DisplayName", typeof(global::Microsoft.Data.Entity.Design.EntityDesigner.MicrosoftDataEntityDesignDomainModel), "Microsoft.Data.Entity.Design.EntityDesigner.GeneratedCode.DomainModelResx")]
	[DslDesign::DescriptionResource("Microsoft.Data.Entity.Design.EntityDesigner.MicrosoftDataEntityDesignDomainModel.Description", typeof(global::Microsoft.Data.Entity.Design.EntityDesigner.MicrosoftDataEntityDesignDomainModel), "Microsoft.Data.Entity.Design.EntityDesigner.GeneratedCode.DomainModelResx")]
	[global::System.CLSCompliant(true)]
	[DslModeling::DependsOnDomainModel(typeof(global::Microsoft.VisualStudio.Modeling.CoreDomainModel))]
	[DslModeling::DependsOnDomainModel(typeof(global::Microsoft.VisualStudio.Modeling.Diagrams.CoreDesignSurfaceDomainModel))]
	[DslModeling::DomainObjectId("eaf6b23c-b622-40ae-9e7e-91cf0cb73708")]
	public partial class MicrosoftDataEntityDesignDomainModel : DslModeling::DomainModel
	{
		#region Constructor, domain model Id
	
		/// <summary>
		/// MicrosoftDataEntityDesignDomainModel domain model Id.
		/// </summary>
		public static readonly global::System.Guid DomainModelId = new global::System.Guid(0xeaf6b23c, 0xb622, 0x40ae, 0x9e, 0x7e, 0x91, 0xcf, 0x0c, 0xb7, 0x37, 0x08);
	
		/// <summary>
		/// Constructor.
		/// </summary>
		/// <param name="store">Store containing the domain model.</param>
		public MicrosoftDataEntityDesignDomainModel(DslModeling::Store store)
			: base(store, DomainModelId)
		{
			// Call the partial method to allow any required serialization setup to be done.
			this.InitializeSerialization(store);		
		}
		
	
		///<Summary>
		/// Defines a partial method that will be called from the constructor to
		/// allow any necessary serialization setup to be done.
		///</Summary>
		///<remarks>
		/// For a DSL created with the DSL Designer wizard, an implementation of this 
		/// method will be generated in the GeneratedCode\SerializationHelper.cs class.
		///</remarks>
		partial void InitializeSerialization(DslModeling::Store store);
	
	
		#endregion
		#region Domain model reflection
			
		/// <summary>
		/// Gets the list of generated domain model types (classes, rules, relationships).
		/// </summary>
		/// <returns>List of types.</returns>
		protected sealed override global::System.Type[] GetGeneratedDomainModelTypes()
		{
			return new global::System.Type[]
			{
				typeof(global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.NameableItem),
				typeof(global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.EntityDesignerViewModel),
				typeof(global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.EntityType),
				typeof(global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.Property),
				typeof(global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.PropertyBase),
				typeof(global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.NavigationProperty),
				typeof(global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.ComplexProperty),
				typeof(global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.ScalarProperty),
				typeof(global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.EntityTypeHasProperties),
				typeof(EntityDesignerViewModelHasEntityTypes),
				typeof(global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.Association),
				typeof(global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.EntityTypeHasNavigationProperties),
				typeof(global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.Inheritance),
				typeof(global::Microsoft.Data.Entity.Design.EntityDesigner.View.EntityDesignerDiagram),
				typeof(global::Microsoft.Data.Entity.Design.EntityDesigner.View.InheritanceConnector),
				typeof(global::Microsoft.Data.Entity.Design.EntityDesigner.View.AssociationConnector),
				typeof(global::Microsoft.Data.Entity.Design.EntityDesigner.View.EntityTypeShape),
				typeof(global::Microsoft.Data.Entity.Design.EntityDesigner.View.FixUpDiagram),
				typeof(global::Microsoft.Data.Entity.Design.EntityDesigner.View.DecoratorPropertyChanged),
				typeof(global::Microsoft.Data.Entity.Design.EntityDesigner.View.ConnectorRolePlayerChanged),
				typeof(global::Microsoft.Data.Entity.Design.EntityDesigner.View.CompartmentItemAddRule),
				typeof(global::Microsoft.Data.Entity.Design.EntityDesigner.View.CompartmentItemDeleteRule),
				typeof(global::Microsoft.Data.Entity.Design.EntityDesigner.View.CompartmentItemRolePlayerChangeRule),
				typeof(global::Microsoft.Data.Entity.Design.EntityDesigner.View.CompartmentItemRolePlayerPositionChangeRule),
				typeof(global::Microsoft.Data.Entity.Design.EntityDesigner.View.CompartmentItemChangeRule),
			};
		}
		/// <summary>
		/// Gets the list of generated domain properties.
		/// </summary>
		/// <returns>List of property data.</returns>
		protected sealed override DomainMemberInfo[] GetGeneratedDomainProperties()
		{
			return new DomainMemberInfo[]
			{
				new DomainMemberInfo(typeof(global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.NameableItem), "Name", global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.NameableItem.NameDomainPropertyId, typeof(global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.NameableItem.NamePropertyHandler)),
				new DomainMemberInfo(typeof(global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.EntityDesignerViewModel), "Namespace", global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.EntityDesignerViewModel.NamespaceDomainPropertyId, typeof(global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.EntityDesignerViewModel.NamespacePropertyHandler)),
				new DomainMemberInfo(typeof(global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.EntityType), "BaseTypeName", global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.EntityType.BaseTypeNameDomainPropertyId, typeof(global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.EntityType.BaseTypeNamePropertyHandler)),
				new DomainMemberInfo(typeof(global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.EntityType), "HasBaseType", global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.EntityType.HasBaseTypeDomainPropertyId, typeof(global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.EntityType.HasBaseTypePropertyHandler)),
				new DomainMemberInfo(typeof(global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.Property), "Type", global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.Property.TypeDomainPropertyId, typeof(global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.Property.TypePropertyHandler)),
				new DomainMemberInfo(typeof(global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.ScalarProperty), "EntityKey", global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.ScalarProperty.EntityKeyDomainPropertyId, typeof(global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.ScalarProperty.EntityKeyPropertyHandler)),
				new DomainMemberInfo(typeof(global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.Association), "Name", global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.Association.NameDomainPropertyId, typeof(global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.Association.NamePropertyHandler)),
				new DomainMemberInfo(typeof(global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.Association), "SourceMultiplicity", global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.Association.SourceMultiplicityDomainPropertyId, typeof(global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.Association.SourceMultiplicityPropertyHandler)),
				new DomainMemberInfo(typeof(global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.Association), "TargetMultiplicity", global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.Association.TargetMultiplicityDomainPropertyId, typeof(global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.Association.TargetMultiplicityPropertyHandler)),
				new DomainMemberInfo(typeof(global::Microsoft.Data.Entity.Design.EntityDesigner.View.EntityDesignerDiagram), "Title", global::Microsoft.Data.Entity.Design.EntityDesigner.View.EntityDesignerDiagram.TitleDomainPropertyId, typeof(global::Microsoft.Data.Entity.Design.EntityDesigner.View.EntityDesignerDiagram.TitlePropertyHandler)),
				new DomainMemberInfo(typeof(global::Microsoft.Data.Entity.Design.EntityDesigner.View.EntityTypeShape), "FillColor", global::Microsoft.Data.Entity.Design.EntityDesigner.View.EntityTypeShape.FillColorDomainPropertyId, typeof(global::Microsoft.Data.Entity.Design.EntityDesigner.View.EntityTypeShape.FillColorPropertyHandler)),
			};
		}
		/// <summary>
		/// Gets the list of generated domain roles.
		/// </summary>
		/// <returns>List of role data.</returns>
		protected sealed override DomainRolePlayerInfo[] GetGeneratedDomainRoles()
		{
			return new DomainRolePlayerInfo[]
			{
				new DomainRolePlayerInfo(typeof(global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.EntityTypeHasProperties), "EntityType", global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.EntityTypeHasProperties.EntityTypeDomainRoleId),
				new DomainRolePlayerInfo(typeof(global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.EntityTypeHasProperties), "Property", global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.EntityTypeHasProperties.PropertyDomainRoleId),
				new DomainRolePlayerInfo(typeof(EntityDesignerViewModelHasEntityTypes), "EntityDesignerViewModel", EntityDesignerViewModelHasEntityTypes.EntityDesignerViewModelDomainRoleId),
				new DomainRolePlayerInfo(typeof(EntityDesignerViewModelHasEntityTypes), "EntityType", EntityDesignerViewModelHasEntityTypes.EntityTypeDomainRoleId),
				new DomainRolePlayerInfo(typeof(global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.Association), "SourceEntityType", global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.Association.SourceEntityTypeDomainRoleId),
				new DomainRolePlayerInfo(typeof(global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.Association), "TargetEntityType", global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.Association.TargetEntityTypeDomainRoleId),
				new DomainRolePlayerInfo(typeof(global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.EntityTypeHasNavigationProperties), "EntityType", global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.EntityTypeHasNavigationProperties.EntityTypeDomainRoleId),
				new DomainRolePlayerInfo(typeof(global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.EntityTypeHasNavigationProperties), "NavigationProperty", global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.EntityTypeHasNavigationProperties.NavigationPropertyDomainRoleId),
				new DomainRolePlayerInfo(typeof(global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.Inheritance), "SourceEntityType", global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.Inheritance.SourceEntityTypeDomainRoleId),
				new DomainRolePlayerInfo(typeof(global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.Inheritance), "TargetEntityType", global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.Inheritance.TargetEntityTypeDomainRoleId),
			};
		}
		#endregion
		#region Factory methods
		private static global::System.Collections.Generic.Dictionary<global::System.Type, int> createElementMap;
	
		/// <summary>
		/// Creates an element of specified type.
		/// </summary>
		/// <param name="partition">Partition where element is to be created.</param>
		/// <param name="elementType">Element type which belongs to this domain model.</param>
		/// <param name="propertyAssignments">New element property assignments.</param>
		/// <returns>Created element.</returns>
		public sealed override DslModeling::ModelElement CreateElement(DslModeling::Partition partition, global::System.Type elementType, DslModeling::PropertyAssignment[] propertyAssignments)
		{
			if (elementType == null) throw new global::System.ArgumentNullException("elementType");
	
			if (createElementMap == null)
			{
				createElementMap = new global::System.Collections.Generic.Dictionary<global::System.Type, int>(12);
				createElementMap.Add(typeof(global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.EntityDesignerViewModel), 0);
				createElementMap.Add(typeof(global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.EntityType), 1);
				createElementMap.Add(typeof(global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.NavigationProperty), 2);
				createElementMap.Add(typeof(global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.ComplexProperty), 3);
				createElementMap.Add(typeof(global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.ScalarProperty), 4);
				createElementMap.Add(typeof(global::Microsoft.Data.Entity.Design.EntityDesigner.View.EntityDesignerDiagram), 5);
				createElementMap.Add(typeof(global::Microsoft.Data.Entity.Design.EntityDesigner.View.InheritanceConnector), 6);
				createElementMap.Add(typeof(global::Microsoft.Data.Entity.Design.EntityDesigner.View.AssociationConnector), 7);
				createElementMap.Add(typeof(global::Microsoft.Data.Entity.Design.EntityDesigner.View.EntityTypeShape), 8);
			}
			int index;
			if (!createElementMap.TryGetValue(elementType, out index))
			{
				// construct exception error message		
				string exceptionError = string.Format(
								global::System.Globalization.CultureInfo.CurrentCulture,
								global::Microsoft.Data.Entity.Design.EntityDesigner.MicrosoftDataEntityDesignDomainModel.SingletonResourceManager.GetString("UnrecognizedElementType"),
								elementType.Name);
				throw new global::System.ArgumentException(exceptionError, "elementType");
			}
			switch (index)
			{
				case 0: return new global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.EntityDesignerViewModel(partition, propertyAssignments);
				case 1: return new global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.EntityType(partition, propertyAssignments);
				case 2: return new global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.NavigationProperty(partition, propertyAssignments);
				case 3: return new global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.ComplexProperty(partition, propertyAssignments);
				case 4: return new global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.ScalarProperty(partition, propertyAssignments);
				case 5: return new global::Microsoft.Data.Entity.Design.EntityDesigner.View.EntityDesignerDiagram(partition, propertyAssignments);
				case 6: return new global::Microsoft.Data.Entity.Design.EntityDesigner.View.InheritanceConnector(partition, propertyAssignments);
				case 7: return new global::Microsoft.Data.Entity.Design.EntityDesigner.View.AssociationConnector(partition, propertyAssignments);
				case 8: return new global::Microsoft.Data.Entity.Design.EntityDesigner.View.EntityTypeShape(partition, propertyAssignments);
				default: return null;
			}
		}
	
		private static global::System.Collections.Generic.Dictionary<global::System.Type, int> createElementLinkMap;
	
		/// <summary>
		/// Creates an element link of specified type.
		/// </summary>
		/// <param name="partition">Partition where element is to be created.</param>
		/// <param name="elementLinkType">Element link type which belongs to this domain model.</param>
		/// <param name="roleAssignments">List of relationship role assignments for the new link.</param>
		/// <param name="propertyAssignments">New element property assignments.</param>
		/// <returns>Created element link.</returns>
		public sealed override DslModeling::ElementLink CreateElementLink(DslModeling::Partition partition, global::System.Type elementLinkType, DslModeling::RoleAssignment[] roleAssignments, DslModeling::PropertyAssignment[] propertyAssignments)
		{
			if (elementLinkType == null) throw new global::System.ArgumentNullException("elementLinkType");
			if (roleAssignments == null) throw new global::System.ArgumentNullException("roleAssignments");
	
			if (createElementLinkMap == null)
			{
				createElementLinkMap = new global::System.Collections.Generic.Dictionary<global::System.Type, int>(5);
				createElementLinkMap.Add(typeof(global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.EntityTypeHasProperties), 0);
				createElementLinkMap.Add(typeof(EntityDesignerViewModelHasEntityTypes), 1);
				createElementLinkMap.Add(typeof(global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.Association), 2);
				createElementLinkMap.Add(typeof(global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.EntityTypeHasNavigationProperties), 3);
				createElementLinkMap.Add(typeof(global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.Inheritance), 4);
			}
			int index;
			if (!createElementLinkMap.TryGetValue(elementLinkType, out index))
			{
				// construct exception error message
				string exceptionError = string.Format(
								global::System.Globalization.CultureInfo.CurrentCulture,
								global::Microsoft.Data.Entity.Design.EntityDesigner.MicrosoftDataEntityDesignDomainModel.SingletonResourceManager.GetString("UnrecognizedElementLinkType"),
								elementLinkType.Name);
				throw new global::System.ArgumentException(exceptionError, "elementLinkType");
			
			}
			switch (index)
			{
				case 0: return new global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.EntityTypeHasProperties(partition, roleAssignments, propertyAssignments);
				case 1: return new EntityDesignerViewModelHasEntityTypes(partition, roleAssignments, propertyAssignments);
				case 2: return new global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.Association(partition, roleAssignments, propertyAssignments);
				case 3: return new global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.EntityTypeHasNavigationProperties(partition, roleAssignments, propertyAssignments);
				case 4: return new global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.Inheritance(partition, roleAssignments, propertyAssignments);
				default: return null;
			}
		}
		#endregion
		#region Resource manager
		
		private static global::System.Resources.ResourceManager resourceManager;
		
		/// <summary>
		/// The base name of this model's resources.
		/// </summary>
		public const string ResourceBaseName = "Microsoft.Data.Entity.Design.EntityDesigner.GeneratedCode.DomainModelResx";
		
		/// <summary>
		/// Gets the DomainModel's ResourceManager. If the ResourceManager does not already exist, then it is created.
		/// </summary>
		public override global::System.Resources.ResourceManager ResourceManager
		{
			[global::System.Diagnostics.DebuggerStepThrough]
			get
			{
				return MicrosoftDataEntityDesignDomainModel.SingletonResourceManager;
			}
		}
	
		/// <summary>
		/// Gets the Singleton ResourceManager for this domain model.
		/// </summary>
		public static global::System.Resources.ResourceManager SingletonResourceManager
		{
			[global::System.Diagnostics.DebuggerStepThrough]
			get
			{
				if (MicrosoftDataEntityDesignDomainModel.resourceManager == null)
				{
					MicrosoftDataEntityDesignDomainModel.resourceManager = new global::System.Resources.ResourceManager(ResourceBaseName, typeof(MicrosoftDataEntityDesignDomainModel).Assembly);
				}
				return MicrosoftDataEntityDesignDomainModel.resourceManager;
			}
		}
		#endregion
		#region Copy/Remove closures
		/// <summary>
		/// CopyClosure cache
		/// </summary>
		private static DslModeling::IElementVisitorFilter copyClosure;
		/// <summary>
		/// DeleteClosure cache
		/// </summary>
		private static DslModeling::IElementVisitorFilter removeClosure;
		/// <summary>
		/// Returns an IElementVisitorFilter that corresponds to the ClosureType.
		/// </summary>
		/// <param name="type">closure type</param>
		/// <param name="rootElements">collection of root elements</param>
		/// <returns>IElementVisitorFilter or null</returns>
		public override DslModeling::IElementVisitorFilter GetClosureFilter(DslModeling::ClosureType type, global::System.Collections.Generic.ICollection<DslModeling::ModelElement> rootElements)
		{
			switch (type)
			{
				case DslModeling::ClosureType.CopyClosure:
					return MicrosoftDataEntityDesignDomainModel.CopyClosure;
				case DslModeling::ClosureType.DeleteClosure:
					return MicrosoftDataEntityDesignDomainModel.DeleteClosure;
			}
			return base.GetClosureFilter(type, rootElements);
		}
		/// <summary>
		/// CopyClosure cache
		/// </summary>
		private static DslModeling::IElementVisitorFilter CopyClosure
		{
			get
			{
				// Incorporate all of the closures from the models we extend
				if (MicrosoftDataEntityDesignDomainModel.copyClosure == null)
				{
					DslModeling::ChainingElementVisitorFilter copyFilter = new DslModeling::ChainingElementVisitorFilter();
					copyFilter.AddFilter(new MicrosoftDataEntityDesignCopyClosure());
					copyFilter.AddFilter(new DslModeling::CoreCopyClosure());
					copyFilter.AddFilter(new DslDiagrams::CoreDesignSurfaceCopyClosure());
					
					MicrosoftDataEntityDesignDomainModel.copyClosure = copyFilter;
				}
				return MicrosoftDataEntityDesignDomainModel.copyClosure;
			}
		}
		/// <summary>
		/// DeleteClosure cache
		/// </summary>
		private static DslModeling::IElementVisitorFilter DeleteClosure
		{
			get
			{
				// Incorporate all of the closures from the models we extend
				if (MicrosoftDataEntityDesignDomainModel.removeClosure == null)
				{
					DslModeling::ChainingElementVisitorFilter removeFilter = new DslModeling::ChainingElementVisitorFilter();
					removeFilter.AddFilter(new MicrosoftDataEntityDesignDeleteClosure());
					removeFilter.AddFilter(new DslModeling::CoreDeleteClosure());
					removeFilter.AddFilter(new DslDiagrams::CoreDesignSurfaceDeleteClosure());
		
					MicrosoftDataEntityDesignDomainModel.removeClosure = removeFilter;
				}
				return MicrosoftDataEntityDesignDomainModel.removeClosure;
			}
		}
		#endregion
		#region Diagram rule helpers
		/// <summary>
		/// Enables rules in this domain model related to diagram fixup for the given store.
		/// If diagram data will be loaded into the store, this method should be called first to ensure
		/// that the diagram behaves properly.
		/// </summary>
		public static void EnableDiagramRules(DslModeling::Store store)
		{
			if(store == null) throw new global::System.ArgumentNullException("store");
			
			DslModeling::RuleManager ruleManager = store.RuleManager;
			ruleManager.EnableRule(typeof(global::Microsoft.Data.Entity.Design.EntityDesigner.View.FixUpDiagram));
			ruleManager.EnableRule(typeof(global::Microsoft.Data.Entity.Design.EntityDesigner.View.DecoratorPropertyChanged));
			ruleManager.EnableRule(typeof(global::Microsoft.Data.Entity.Design.EntityDesigner.View.ConnectorRolePlayerChanged));
			ruleManager.EnableRule(typeof(global::Microsoft.Data.Entity.Design.EntityDesigner.View.CompartmentItemAddRule));
			ruleManager.EnableRule(typeof(global::Microsoft.Data.Entity.Design.EntityDesigner.View.CompartmentItemDeleteRule));
			ruleManager.EnableRule(typeof(global::Microsoft.Data.Entity.Design.EntityDesigner.View.CompartmentItemRolePlayerChangeRule));
			ruleManager.EnableRule(typeof(global::Microsoft.Data.Entity.Design.EntityDesigner.View.CompartmentItemRolePlayerPositionChangeRule));
			ruleManager.EnableRule(typeof(global::Microsoft.Data.Entity.Design.EntityDesigner.View.CompartmentItemChangeRule));
		}
		
		/// <summary>
		/// Disables rules in this domain model related to diagram fixup for the given store.
		/// </summary>
		public static void DisableDiagramRules(DslModeling::Store store)
		{
			if(store == null) throw new global::System.ArgumentNullException("store");
			
			DslModeling::RuleManager ruleManager = store.RuleManager;
			ruleManager.DisableRule(typeof(global::Microsoft.Data.Entity.Design.EntityDesigner.View.FixUpDiagram));
			ruleManager.DisableRule(typeof(global::Microsoft.Data.Entity.Design.EntityDesigner.View.DecoratorPropertyChanged));
			ruleManager.DisableRule(typeof(global::Microsoft.Data.Entity.Design.EntityDesigner.View.ConnectorRolePlayerChanged));
			ruleManager.DisableRule(typeof(global::Microsoft.Data.Entity.Design.EntityDesigner.View.CompartmentItemAddRule));
			ruleManager.DisableRule(typeof(global::Microsoft.Data.Entity.Design.EntityDesigner.View.CompartmentItemDeleteRule));
			ruleManager.DisableRule(typeof(global::Microsoft.Data.Entity.Design.EntityDesigner.View.CompartmentItemRolePlayerChangeRule));
			ruleManager.DisableRule(typeof(global::Microsoft.Data.Entity.Design.EntityDesigner.View.CompartmentItemRolePlayerPositionChangeRule));
			ruleManager.DisableRule(typeof(global::Microsoft.Data.Entity.Design.EntityDesigner.View.CompartmentItemChangeRule));
		}
		#endregion
	}
		
	#region Copy/Remove closure classes
	/// <summary>
	/// Remove closure visitor filter
	/// </summary>
	[global::System.CLSCompliant(true)]
	public partial class MicrosoftDataEntityDesignDeleteClosure : MicrosoftDataEntityDesignDeleteClosureBase, DslModeling::IElementVisitorFilter
	{
		/// <summary>
		/// Constructor
		/// </summary>
		public MicrosoftDataEntityDesignDeleteClosure() : base()
		{
		}
	}
	
	/// <summary>
	/// Base class for remove closure visitor filter
	/// </summary>
	[global::System.CLSCompliant(true)]
	public partial class MicrosoftDataEntityDesignDeleteClosureBase : DslModeling::IElementVisitorFilter
	{
		/// <summary>
		/// DomainRoles
		/// </summary>
		private global::System.Collections.Specialized.HybridDictionary domainRoles;
		/// <summary>
		/// Constructor
		/// </summary>
		public MicrosoftDataEntityDesignDeleteClosureBase()
		{
			#region Initialize DomainData Table
			DomainRoles.Add(global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.EntityTypeHasProperties.PropertyDomainRoleId, true);
			DomainRoles.Add(global::Microsoft.Data.Entity.Design.EntityDesigner.EntityDesignerViewModelHasEntityTypes.EntityTypeDomainRoleId, true);
			DomainRoles.Add(global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.EntityTypeHasNavigationProperties.NavigationPropertyDomainRoleId, true);
			#endregion
		}
		/// <summary>
		/// Called to ask the filter if a particular relationship from a source element should be included in the traversal
		/// </summary>
		/// <param name="walker">ElementWalker that is traversing the model</param>
		/// <param name="sourceElement">Model Element playing the source role</param>
		/// <param name="sourceRoleInfo">DomainRoleInfo of the role that the source element is playing in the relationship</param>
		/// <param name="domainRelationshipInfo">DomainRelationshipInfo for the ElementLink in question</param>
		/// <param name="targetRelationship">Relationship in question</param>
		/// <returns>Yes if the relationship should be traversed</returns>
		public virtual DslModeling::VisitorFilterResult ShouldVisitRelationship(DslModeling::ElementWalker walker, DslModeling::ModelElement sourceElement, DslModeling::DomainRoleInfo sourceRoleInfo, DslModeling::DomainRelationshipInfo domainRelationshipInfo, DslModeling::ElementLink targetRelationship)
		{
			return DslModeling::VisitorFilterResult.Yes;
		}
		/// <summary>
		/// Called to ask the filter if a particular role player should be Visited during traversal
		/// </summary>
		/// <param name="walker">ElementWalker that is traversing the model</param>
		/// <param name="sourceElement">Model Element playing the source role</param>
		/// <param name="elementLink">Element Link that forms the relationship to the role player in question</param>
		/// <param name="targetDomainRole">DomainRoleInfo of the target role</param>
		/// <param name="targetRolePlayer">Model Element that plays the target role in the relationship</param>
		/// <returns></returns>
		public virtual DslModeling::VisitorFilterResult ShouldVisitRolePlayer(DslModeling::ElementWalker walker, DslModeling::ModelElement sourceElement, DslModeling::ElementLink elementLink, DslModeling::DomainRoleInfo targetDomainRole, DslModeling::ModelElement targetRolePlayer)
		{
			if (targetDomainRole == null) throw new global::System.ArgumentNullException("targetDomainRole");
			return this.DomainRoles.Contains(targetDomainRole.Id) ? DslModeling::VisitorFilterResult.Yes : DslModeling::VisitorFilterResult.DoNotCare;
		}
		/// <summary>
		/// DomainRoles
		/// </summary>
		private global::System.Collections.Specialized.HybridDictionary DomainRoles
		{
			get
			{
				if (this.domainRoles == null)
				{
					this.domainRoles = new global::System.Collections.Specialized.HybridDictionary();
				}
				return this.domainRoles;
			}
		}
	
	}
	/// <summary>
	/// Copy closure visitor filter
	/// </summary>
	[global::System.CLSCompliant(true)]
	public partial class MicrosoftDataEntityDesignCopyClosure : MicrosoftDataEntityDesignCopyClosureBase, DslModeling::IElementVisitorFilter
	{
		/// <summary>
		/// Constructor
		/// </summary>
		public MicrosoftDataEntityDesignCopyClosure() : base()
		{
		}
	}
	/// <summary>
	/// Base class for copy closure visitor filter
	/// </summary>
	[global::System.CLSCompliant(true)]
	public partial class MicrosoftDataEntityDesignCopyClosureBase : DslModeling::CopyClosureFilter, DslModeling::IElementVisitorFilter
	{
		/// <summary>
		/// Constructor
		/// </summary>
		public MicrosoftDataEntityDesignCopyClosureBase():base()
		{
		}
	}
	#endregion
		
}

