src/Misc/EFTools/EntityDesignEntityDesigner/GeneratedCode/ConnectionBuilders.cs
/// <summary>
/// Test whether a given pair of model elements are acceptable to this ConnectionBuilder as the source and target of a connection
/// </summary>
/// <param name="candidateSource">The model element to test as a source</param>
/// <param name="candidateTarget">The model element to test as a target</param>
/// <returns>Whether the elements can be used as the source and target of a connection</returns>
Test whether a given pair of model elements are acceptable to this ConnectionBuilder as the source and target of a connection
Test whether a given pair of model elements are acceptable to this ConnectionBuilder as the source and target of a connection
[global::System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")]
		[global::System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity", Justification = "Generated code.")]
		public static bool CanAcceptSourceAndTarget(DslModeling::ModelElement candidateSource, DslModeling::ModelElement candidateTarget)
		{
			if (candidateSource == null)
			{
				if (candidateTarget != null)
				{
					throw new global::System.ArgumentNullException("candidateSource");
				}
				else 
				{
					return false;
				}
			}
			bool acceptSource = CanAcceptSource(candidateSource);
			if (!acceptSource || candidateTarget == null)
			{
				return acceptSource;
			}
			else 
			{
				if (candidateSource is global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.EntityType)
				{
					if (candidateTarget is global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.EntityType)
					{
						global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.EntityType sourceEntityType = (global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.EntityType)candidateSource;
						global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.EntityType targetEntityType = (global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.EntityType)candidateTarget;
						if(targetEntityType == null || global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.Inheritance.GetLinkToBaseType(targetEntityType) != null) return false;
						if(targetEntityType == null || sourceEntityType == null || global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.Inheritance.GetLinks(sourceEntityType, targetEntityType).Count > 0) return false;
						return true;
					}
				}
			}
			return false;
		}
[ global :: System . Diagnostics . CodeAnalysis . SuppressMessage ( " " , " " ) ] [ global :: System . Diagnostics . CodeAnalysis . SuppressMessage ( " " , " " , Justification = " " ) ] public static bool CanAcceptSourceAndTarget ( DslModeling :: ModelElement candidateSource , DslModeling :: ModelElement candidateTarget ) { if ( candidateSource == null ) { if ( candidateTarget != null ) { throw new global :: System . ArgumentNullException ( " " ) ; } else { return false ; } } bool acceptSource = CanAcceptSource ( candidateSource ) ; if ( ! acceptSource || candidateTarget == null ) { return acceptSource ; } else { if ( candidateSource is global :: Microsoft . Data . Entity . Design . EntityDesigner . ViewModel . EntityType ) { if ( candidateTarget is global :: Microsoft . Data . Entity . Design . EntityDesigner . ViewModel . EntityType ) { global :: Microsoft . Data . Entity . Design . EntityDesigner . ViewModel . EntityType sourceEntityType = ( global :: Microsoft . Data . Entity . Design . EntityDesigner . ViewModel . EntityType ) candidateSource ; global :: Microsoft . Data . Entity . Design . EntityDesigner . ViewModel . EntityType targetEntityType = ( global :: Microsoft . Data . Entity . Design . EntityDesigner . ViewModel . EntityType ) candidateTarget ; if ( targetEntityType == null || global :: Microsoft . Data . Entity . Design . EntityDesigner . ViewModel . Inheritance . GetLinkToBaseType ( targetEntityType ) != null ) return false ; if ( targetEntityType == null || sourceEntityType == null || global :: Microsoft . Data . Entity . Design . EntityDesigner . ViewModel . Inheritance . GetLinks ( sourceEntityType , targetEntityType ) . Count > 0 ) return false ; return true ; } } } return false ; }
Test whether a given pair of model elements are acceptable to this ConnectionBuilder as the source and target of a connection
Test whether a given pair of model elements are acceptable to this ConnectionBuilder as the source and target of a connection
// Accepts null, null; source, null; source, target but NOT null, target // Both null // If the source wasn't accepted then there's no point checking targets. // If there is no target then the source controls the accept. // Check combinations
Whether the elements can be used as the source and target of a connection
Whether the elements can be used as the source and target of a connection
candidateSource
DslModeling::ModelElement
The model element to test as a source
The model element to test as a source
candidateTarget
DslModeling::ModelElement
The model element to test as a target
The model element to test as a target