src/Misc/EFTools/EntityDesignEntityDesigner/GeneratedCode/Serializer.cs
/// <summary>
/// Calculates a monikerized string reference to a EntityType.
/// </summary>
/// <param name="serializationContext">Serialization context.</param>
/// <param name="sourceElement">Source side of reference relationship. The referenced target element will be serialized.</param>
/// <param name="targetElement">Target side of relationship that will be serialized.</param>
/// <returns>A monikerized string reference to target element.</returns>		
Calculates a monikerized string reference to a EntityType.
Calculates a monikerized string reference to a EntityType .
public override string SerializeReference(DslModeling::SerializationContext serializationContext, DslModeling::ModelElement sourceElement, DslModeling::ModelElement targetElement)
		{
			#region Check Parameters
			global::System.Diagnostics.Debug.Assert(serializationContext != null);
			if (serializationContext == null)
				throw new global::System.ArgumentNullException("serializationContext");
			global::System.Diagnostics.Debug.Assert(sourceElement != null);
			if (sourceElement == null)
				throw new global::System.ArgumentNullException ("sourceElement");
			global::System.Diagnostics.Debug.Assert (sourceElement is global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.EntityType, "Expecting an instance of EntityType!");
			global::System.Diagnostics.Debug.Assert(targetElement != null);
			if (targetElement == null)
				throw new global::System.ArgumentNullException ("targetElement");
			global::System.Diagnostics.Debug.Assert (targetElement is global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.EntityType, "Expecting an instance of EntityType!");
			#endregion
			DslModeling::DomainClassXmlSerializer targetSerializer = serializationContext.Directory.GetSerializer(targetElement.GetDomainClass().Id);
			global::System.Diagnostics.Debug.Assert(targetSerializer != null, "Cannot find serializer for " + targetElement.GetDomainClass().Name + "!");
			string targetMoniker = targetSerializer.CalculateQualifiedName(serializationContext.Directory, targetElement);
			string targetQualifier = targetSerializer.GetMonikerQualifier(serializationContext.Directory, targetElement);
			if (!string.IsNullOrEmpty(targetQualifier))
			{
				DslModeling::DomainClassXmlSerializer sourceSerializer = serializationContext.Directory.GetSerializer(sourceElement.GetDomainClass().Id);
				global::System.Diagnostics.Debug.Assert(sourceSerializer != null, "Cannot find serializer for " + sourceElement.GetDomainClass().Name + "!");
				string sourceQualifier = sourceSerializer.GetMonikerQualifier(serializationContext.Directory, sourceElement);
				if (string.Compare(targetQualifier, sourceQualifier, global::System.StringComparison.CurrentCulture) == 0)
				{
					global::System.Diagnostics.Debug.Assert(targetMoniker.StartsWith(targetQualifier + "/", global::System.StringComparison.CurrentCulture));
					string shortFormTargetMoniker = targetMoniker.Substring(targetQualifier.Length + 1);
					if (!DslModeling::SimpleMonikerResolver.IsFullyQualified(shortFormTargetMoniker))
						targetMoniker = shortFormTargetMoniker;
				}
			}
			return targetMoniker;
		}
public override string SerializeReference ( DslModeling :: SerializationContext serializationContext , DslModeling :: ModelElement sourceElement , DslModeling :: ModelElement targetElement ) { region  Check Parameters global :: System . Diagnostics . Debug . Assert ( serializationContext != null ) ; if ( serializationContext == null ) throw new global :: System . ArgumentNullException ( " " ) ; global :: System . Diagnostics . Debug . Assert ( sourceElement != null ) ; if ( sourceElement == null ) throw new global :: System . ArgumentNullException ( " " ) ; global :: System . Diagnostics . Debug . Assert ( sourceElement is global :: Microsoft . Data . Entity . Design . EntityDesigner . ViewModel . EntityType , " " ) ; global :: System . Diagnostics . Debug . Assert ( targetElement != null ) ; if ( targetElement == null ) throw new global :: System . ArgumentNullException ( " " ) ; global :: System . Diagnostics . Debug . Assert ( targetElement is global :: Microsoft . Data . Entity . Design . EntityDesigner . ViewModel . EntityType , " " ) ; endregion DslModeling :: DomainClassXmlSerializer targetSerializer = serializationContext . Directory . GetSerializer ( targetElement . GetDomainClass ( ) . Id ) ; global :: System . Diagnostics . Debug . Assert ( targetSerializer != null , " " + targetElement . GetDomainClass ( ) . Name + " " ) ; string targetMoniker = targetSerializer . CalculateQualifiedName ( serializationContext . Directory , targetElement ) ; string targetQualifier = targetSerializer . GetMonikerQualifier ( serializationContext . Directory , targetElement ) ; if ( ! string . IsNullOrEmpty ( targetQualifier ) ) { DslModeling :: DomainClassXmlSerializer sourceSerializer = serializationContext . Directory . GetSerializer ( sourceElement . GetDomainClass ( ) . Id ) ; global :: System . Diagnostics . Debug . Assert ( sourceSerializer != null , " " + sourceElement . GetDomainClass ( ) . Name + " " ) ; string sourceQualifier = sourceSerializer . GetMonikerQualifier ( serializationContext . Directory , sourceElement ) ; if ( string . Compare ( targetQualifier , sourceQualifier , global :: System . StringComparison . CurrentCulture ) == 0 ) { global :: System . Diagnostics . Debug . Assert ( targetMoniker . StartsWith ( targetQualifier + " " , global :: System . StringComparison . CurrentCulture ) ) ; string shortFormTargetMoniker = targetMoniker . Substring ( targetQualifier . Length + 1 ) ; if ( ! DslModeling :: SimpleMonikerResolver . IsFullyQualified ( shortFormTargetMoniker ) ) targetMoniker = shortFormTargetMoniker ; } } return targetMoniker ; }
Calculates a monikerized string reference to a EntityType.
Calculates a monikerized string reference to a EntityType .
// full form reference // See if we can create a short form reference by omitting the qualifier
A monikerized string reference to target element.
A monikerized string reference to target element .
serializationContext
DslModeling::SerializationContext
None
sourceElement
DslModeling::ModelElement
Source side of reference relationship. The referenced target element will be serialized.
Source side of reference relationship . The referenced target element will be serialized .
targetElement
DslModeling::ModelElement
Target side of relationship that will be serialized.
Target side of relationship that will be serialized .