internal static TypeUsage ValidateAndConvertTypeUsage(
            TypeUsage cspaceType,
            TypeUsage sspaceType)
        {
            // if we are already C-Space, dont call the provider. this can happen for functions.
            var modelEquivalentSspace = sspaceType;

            if (sspaceType.EdmType.DataSpace
                == DataSpace.SSpace)
            {
                modelEquivalentSspace = sspaceType.GetModelTypeUsage();
            }

            // check that cspace type is subtype of c-space equivalent type from the ssdl definition
            if (ValidateScalarTypesAreCompatible(cspaceType, modelEquivalentSspace))
            {
                return(modelEquivalentSspace);
            }
            return(null);
        }
 /// <summary>
 ///     Returns a model (C-Space) typeusage for the given typeusage. if the type is already in c-space, it returns
 ///     the given typeusage. The typeUsage returned is created by invoking the provider service to map from provider
 ///     specific type to model type.
 /// </summary>
 /// <param name="typeUsage"> typeusage </param>
 /// <returns> the respective Model (C-Space) typeusage </returns>
 internal static TypeUsage GetModelTypeUsage(TypeUsage typeUsage)
 {
     return(typeUsage.GetModelTypeUsage());
 }