private IEdmTypeReference ComputeType()
        {
            bool   wasCollection;
            string typeName = this.navigationProperty.Type;

            const string CollectionPrefix = CsdlConstants.Value_Collection + "(";

            if (typeName.StartsWith(CollectionPrefix, StringComparison.Ordinal) && typeName.EndsWith(")", StringComparison.Ordinal))
            {
                wasCollection = true;
                typeName      = typeName.Substring(CollectionPrefix.Length, (typeName.Length - CollectionPrefix.Length) - 1);
            }
            else
            {
                wasCollection = false;
            }

            IEdmEntityType targetType = this.declaringType.Context.FindType(typeName) as IEdmEntityType;

            if (targetType == null)
            {
                targetType = new UnresolvedEntityType(typeName, this.Location);
            }

            bool nullable = !wasCollection && (this.navigationProperty.Nullable ?? CsdlConstants.Default_Nullable);

            IEdmEntityTypeReference targetTypeReference = new EdmEntityTypeReference(targetType, nullable);

            if (wasCollection)
            {
                return(new EdmCollectionTypeReference(new EdmCollectionType(targetTypeReference)));
            }

            return(targetTypeReference);
        }
        private IEdmTypeReference ComputeType()
        {
            bool wasCollection;
            string typeName = this.navigationProperty.Type;

            const string CollectionPrefix = CsdlConstants.Value_Collection + "(";
            if (typeName.StartsWith(CollectionPrefix, StringComparison.Ordinal) && typeName.EndsWith(")", StringComparison.Ordinal))
            {
                wasCollection = true;
                typeName = typeName.Substring(CollectionPrefix.Length, (typeName.Length - CollectionPrefix.Length) - 1);
            }
            else
            {
                wasCollection = false;
            }

            IEdmEntityType targetType = this.declaringType.Context.FindType(typeName) as IEdmEntityType;
            if (targetType == null)
            {
                targetType = new UnresolvedEntityType(typeName, this.Location);
            }

            bool nullable = !wasCollection && (this.navigationProperty.Nullable ?? CsdlConstants.Default_Nullable);

            IEdmEntityTypeReference targetTypeReference = new EdmEntityTypeReference(targetType, nullable);
            if (wasCollection)
            {
                return new EdmCollectionTypeReference(new EdmCollectionType(targetTypeReference));
            }

            return targetTypeReference;
        }