Пример #1
0
        private bool TryGetType <T>(
            ISchemaTypeReference reference,
            out T type)
            where T : IType
        {
            if (reference.Type is IType schemaType)
            {
                INamedType namedType = schemaType.NamedType();
                if (_typeInitializer.Types.Any(t => t.Value.Type == namedType) &&
                    schemaType is T casted)
                {
                    type = casted;
                    return(true);
                }
            }

            type = default;
            return(false);
        }
        public bool Equals(ISchemaTypeReference other)
        {
            if (other is null)
            {
                return(false);
            }

            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            if (Type == other.Type ||
                (Type is IType a && other.Type is IType b && a.IsEqualTo(b)))
            {
                return(Context == other.Context &&
                       IsTypeNullable.Equals(other.IsTypeNullable) &&
                       IsElementTypeNullable.Equals(other.IsElementTypeNullable));
            }

            return(false);
        }