src/Misc/EFTools/EntityDesignEntityDesigner/GeneratedCode/SerializationHelper.cs
/// <summary>
/// Check to make sure all elements in the model will have unambiguous monikers when serialized.
/// </summary>
Check to make sure all elements in the model will have unambiguous monikers when serialized.
Check to make sure all elements in the model will have unambiguous monikers when serialized .
[DslValidation::ValidationMethod(DslValidation::ValidationCategories.Load | DslValidation::ValidationCategories.Save | DslValidation::ValidationCategories.Menu)]
		private void ValidateMonikerAmbiguity(DslValidation::ValidationContext context)
		{
			if (this.Store.InSerializationTransaction)
			{
				return;
			}
			global::System.Collections.Generic.IDictionary<global::System.Guid, DslModeling::IMonikerResolver> monikerResolvers = global::Microsoft.Data.Entity.Design.EntityDesigner.MicrosoftDataEntityDesignSerializationHelper.Instance.GetMonikerResolvers(this.Store);
			foreach (DslModeling::ModelElement element in this.Store.ElementDirectory.AllElements)
			{
				global::System.Guid domainModelId = element.GetDomainClass().DomainModel.Id;
				DslModeling::IMonikerResolver monikerResolver = null;
				if (monikerResolvers.TryGetValue(domainModelId, out monikerResolver) && monikerResolver != null)
				{
					DslModeling::SimpleMonikerResolver simpleMonikerResolver = monikerResolver as DslModeling::SimpleMonikerResolver;
					if (simpleMonikerResolver != null)
					{
						try
						{
							simpleMonikerResolver.ProcessAddedElement(element);
						}
						catch (DslModeling::AmbiguousMonikerException amEx)
						{	
							context.LogError(
								string.Format(
									global::System.Globalization.CultureInfo.CurrentCulture,
									global::Microsoft.Data.Entity.Design.EntityDesigner.MicrosoftDataEntityDesignDomainModel.SingletonResourceManager.GetString("AmbiguousMoniker"),
									amEx.Moniker,
									DslModeling::SerializationUtilities.GetElementName(element),
									DslModeling::SerializationUtilities.GetElementName(amEx.Element)
								),
								"AmbiguousMoniker", 
								this,
								amEx.Element
							);
						}
					}
				}
			}
			foreach (DslModeling::IMonikerResolver monikerResolver in monikerResolvers.Values)
			{
				DslModeling::SimpleMonikerResolver simpleMonikerResolver = monikerResolver as DslModeling::SimpleMonikerResolver;
				if (simpleMonikerResolver != null)
					simpleMonikerResolver.Reset();
			}
			monikerResolvers.Clear();
		}
[ DslValidation :: ValidationMethod ( DslValidation :: ValidationCategories . Load | DslValidation :: ValidationCategories . Save | DslValidation :: ValidationCategories . Menu ) ] private void ValidateMonikerAmbiguity ( DslValidation :: ValidationContext context ) { if ( this . Store . InSerializationTransaction ) { return ; } global :: System . Collections . Generic . IDictionary < global :: System . Guid , DslModeling :: IMonikerResolver > monikerResolvers = global :: Microsoft . Data . Entity . Design . EntityDesigner . MicrosoftDataEntityDesignSerializationHelper . Instance . GetMonikerResolvers ( this . Store ) ; foreach ( DslModeling :: ModelElement element in this . Store . ElementDirectory . AllElements ) { global :: System . Guid domainModelId = element . GetDomainClass ( ) . DomainModel . Id ; DslModeling :: IMonikerResolver monikerResolver = null ; if ( monikerResolvers . TryGetValue ( domainModelId , out monikerResolver ) && monikerResolver != null ) { DslModeling :: SimpleMonikerResolver simpleMonikerResolver = monikerResolver as DslModeling :: SimpleMonikerResolver ; if ( simpleMonikerResolver != null ) { try { simpleMonikerResolver . ProcessAddedElement ( element ) ; } catch ( DslModeling :: AmbiguousMonikerException amEx ) { context . LogError ( string . Format ( global :: System . Globalization . CultureInfo . CurrentCulture , global :: Microsoft . Data . Entity . Design . EntityDesigner . MicrosoftDataEntityDesignDomainModel . SingletonResourceManager . GetString ( " " ) , amEx . Moniker , DslModeling :: SerializationUtilities . GetElementName ( element ) , DslModeling :: SerializationUtilities . GetElementName ( amEx . Element ) ) , " " , this , amEx . Element ) ; } } } } foreach ( DslModeling :: IMonikerResolver monikerResolver in monikerResolvers . Values ) { DslModeling :: SimpleMonikerResolver simpleMonikerResolver = monikerResolver as DslModeling :: SimpleMonikerResolver ; if ( simpleMonikerResolver != null ) simpleMonikerResolver . Reset ( ) ; } monikerResolvers . Clear ( ) ; }
Check to make sure all elements in the model will have unambiguous monikers when serialized.
Check to make sure all elements in the model will have unambiguous monikers when serialized .
// Don't run this rule when deserializing - any ambiguous monikers will  // already have stopped the file from loading. // Ambiguous moniker detected. // Clean up the created moniker resolvers after the check.
context
DslValidation::ValidationContext