internal static string FullNameWithNamespace(this IEdmTypeReference type, string proxyClassNamespace)
        {
            var definition = type?.Definition as IEdmSchemaElement;

            if (definition == null && type?.IsCollection() == true)
            {
                definition = type?.AsCollection()?.ElementType()?.Definition as IEdmSchemaElement;
            }

            return(definition?.FullNameWithNamespace(proxyClassNamespace));
        }
        internal static string ToCodeStringType(this IEdmTypeReference edmTypeReference, string proxyClassNamespace)
        {
            var result = string.Empty;

            switch (edmTypeReference)
            {
            case var pt when pt.IsPrimitive():
                result = $"global::System.{pt.PrimitiveKind()}";

                if (pt.IsNullable && !pt.IsString())
                {
                    result = $"Nullable<{result}>";
                }
                break;

            case var pt when pt.IsCollection():
                var elementType = ToCodeStringType(pt.AsCollection().ElementType(), proxyClassNamespace);

                result = $"IEnumerable<{elementType}>";
                break;

            case var pt when pt.IsComplex():
                result = pt.FullNameWithNamespace(proxyClassNamespace);

                break;

            case var pt when pt.IsEnum():
                result = pt.FullNameWithNamespace(proxyClassNamespace);

                break;

            case var pt when pt.IsEntity():
                result = pt.FullNameWithNamespace(proxyClassNamespace);

                break;

            case var pt when pt.IsEntityReference():
                result = pt.FullNameWithNamespace(proxyClassNamespace);

                break;
            }
            return(result);
        }
Esempio n. 3
0
 public static object TypeIs(object value, Edm.IEdmTypeReference typeReference)
 {
     throw new NotImplementedException();
 }