src/Misc/EFTools/EntityDesignModel/ModelHelper.cs
/// <summary>
///     This will return either the ComplexType, EntityType, null, or the primitive type name
/// </summary>
This will return either the ComplexType, EntityType, null, or the primitive type name
This will return either the ComplexType EntityType null or the primitive type name
internal static object FindComplexTypeEntityTypeOrPrimitiveTypeForFunctionImportReturnType(
            ConceptualEntityModel cModel, string returnTypeAsString)
        {
            if (returnTypeAsString == Tools.XmlDesignerBase.Resources.NoneDisplayValueUsedForUX)
            {
                return Tools.XmlDesignerBase.Resources.NoneDisplayValueUsedForUX;
            }
            var desanitizedReturnType = UnwrapCollectionAroundFunctionImportReturnType(returnTypeAsString, true);
            object returnTypeObject = FindComplexType(cModel, desanitizedReturnType);
            if (null != returnTypeObject)
            {
                return returnTypeObject;
            }
            returnTypeObject = FindEntityType(cModel, desanitizedReturnType);
            if (null != returnTypeObject)
            {
                return returnTypeObject;
            }
            Debug.Assert(
                AllPrimitiveTypes(cModel.Artifact.SchemaVersion).Contains(desanitizedReturnType),
                "Why isn't the return type of the function import either 'None', a primitive type, or an entity type?");
            returnTypeObject = desanitizedReturnType;
            return returnTypeObject;
        }
internal static object FindComplexTypeEntityTypeOrPrimitiveTypeForFunctionImportReturnType ( ConceptualEntityModel cModel , string returnTypeAsString ) { if ( returnTypeAsString == Tools . XmlDesignerBase . Resources . NoneDisplayValueUsedForUX ) { return Tools . XmlDesignerBase . Resources . NoneDisplayValueUsedForUX ; } var desanitizedReturnType = UnwrapCollectionAroundFunctionImportReturnType ( returnTypeAsString , true ) ; object returnTypeObject = FindComplexType ( cModel , desanitizedReturnType ) ; if ( null != returnTypeObject ) { return returnTypeObject ; } returnTypeObject = FindEntityType ( cModel , desanitizedReturnType ) ; if ( null != returnTypeObject ) { return returnTypeObject ; } Debug . Assert ( AllPrimitiveTypes ( cModel . Artifact . SchemaVersion ) . Contains ( desanitizedReturnType ) , " " ) ; returnTypeObject = desanitizedReturnType ; return returnTypeObject ; }
This will return either the ComplexType, EntityType, null, or the primitive type name
This will return either the ComplexType EntityType null or the primitive type name
// this will remove the 'Collection' around the return type. It will now either be 'None', // the primitive type name, complec type name, or entity name. // if this is a complex type name, attempt to get the complex type object // if this is an entity type name, attempt to get the entity type object // then this is a primitive type. Do a double-check here...
cModel
ConceptualEntityModel
returnTypeAsString
string