/// <summary>
 /// Gets the corresponding CLR type for a given Edm primitive type.
 /// </summary>
 /// <param name="edmPrimitiveType">The given Edm primitive type.</param>
 /// <returns>Null or the CLR type.</returns>
 public virtual Type GetClrPrimitiveType(IEdmPrimitiveTypeReference edmPrimitiveType)
 {
     return(BuiltInPrimitiveTypes
            .Where(kvp => edmPrimitiveType.Definition.IsEquivalentTo(kvp.Value.Definition) && (!edmPrimitiveType.IsNullable || kvp.Key.IsNullable()))
            .Select(kvp => kvp.Key)
            .FirstOrDefault());
 }
 /// <summary>
 /// Gets the corresponding Edm primitive type for the given CLR type.
 /// </summary>
 /// <param name="clrType">The given CLR type.</param>
 /// <returns>Null or the Edm primitive type.</returns>
 public virtual IEdmPrimitiveTypeReference GetEdmPrimitiveType(Type clrType)
 {
     return(BuiltInPrimitiveTypes.TryGetValue(clrType, out IEdmPrimitiveTypeReference primitive) ? primitive : null);
 }