private bool TryNormalizeClrReference( IClrTypeReference typeReference, out ITypeReference normalized) { if (!BaseTypes.IsNonGenericBaseType(typeReference.Type) && _typeInspector.TryCreate(typeReference.Type, out Utilities.TypeInfo typeInfo)) { if (IsTypeSystemObject(typeInfo.ClrType)) { normalized = new ClrTypeReference( typeInfo.ClrType, SchemaTypeReference.InferTypeContext(typeInfo.ClrType)); return(true); } else { for (int i = 0; i < typeInfo.Components.Count; i++) { var n = new ClrTypeReference( typeInfo.Components[i], typeReference.Context); if ((ClrTypes.TryGetValue( n, out ITypeReference r) || ClrTypes.TryGetValue( n.WithoutContext(), out r))) { normalized = r; return(true); } } } } normalized = null; return(false); }
private bool TryNormalizeClrReference( IClrTypeReference typeReference, out IClrTypeReference normalized) { if (!BaseTypes.IsNonGenericBaseType(typeReference.Type) && _typeInspector.TryCreate(typeReference.Type, out Utilities.TypeInfo typeInfo)) { if (IsTypeSystemObject(typeInfo.ClrType)) { normalized = new ClrTypeReference( typeInfo.ClrType, SchemaTypeReference.InferTypeContext(typeInfo.ClrType)); return(true); } else { normalized = new ClrTypeReference( typeInfo.ClrType, typeReference.Context); if ((_clrTypes.TryGetValue( normalized, out ITypeReference r) || _clrTypes.TryGetValue( normalized.WithoutContext(), out r)) && r is IClrTypeReference cr) { normalized = cr; return(true); } } } normalized = null; return(false); }