private string TypeNameForUri(Type type) { Debug.Assert(type != null, "type != null"); type = Nullable.GetUnderlyingType(type) ?? type; if (ClientConvert.IsKnownType(type)) { if (ClientConvert.IsSupportedPrimitiveTypeForUri(type)) { return(ClientConvert.ToTypeName(type)); } throw new NotSupportedException(string.Format(CultureInfo.CurrentCulture, SR.ALinqCantCastToUnsupportedPrimitive, type.Name)); } else { return(null); // return this.context.ResolveNameFromType(type) ?? type.FullName; } }
internal override Expression VisitUnary(UnaryExpression u) { Debug.Assert(u != null, "u != null"); if (ResourceBinder.PatternRules.MatchConvertToAssignable(u)) { return(base.VisitUnary(u)); } if ((u.NodeType == ExpressionType.Convert) || (u.NodeType == ExpressionType.ConvertChecked)) { Type sourceType = Nullable.GetUnderlyingType(u.Operand.Type) ?? u.Operand.Type; Type targetType = Nullable.GetUnderlyingType(u.Type) ?? u.Type; if (ClientConvert.IsKnownType(sourceType) && ClientConvert.IsKnownType(targetType)) { return(base.Visit(u.Operand)); } } throw new NotSupportedException(string.Format(CultureInfo.CurrentCulture, SR.ALinqExpressionNotSupportedInProjectionToEntity, this.type, u.ToString())); }