Exemplo n.º 1
0
        /// <summary>
        /// Gets framework and provider specific information
        ///
        /// This method should never return null.
        /// </summary>
        /// <param name="informationType">The name of the information to be retrieved.</param>
        /// <returns>An XmlReader at the begining of the information requested.</returns>
        public XmlReader GetInformation(string informationType)
        {
            XmlReader reader = null;

            try
            {
                reader = GetDbInformation(informationType);
            }
            catch (Exception e)
            {
                // we should not be wrapping all exceptions
                if (EntityUtil.IsCatchableExceptionType(e))
                {
                    // we don't want folks to have to know all the various types of exceptions that can
                    // occur, so we just rethrow a ProviderIncompatibleException and make whatever we caught
                    // the inner exception of it.
                    throw EntityUtil.ProviderIncompatible(
                              System.Data.Entity.Strings.EntityClient_FailedToGetInformation(informationType), e);
                }
                throw;
            }
            if (reader == null)
            {
                // if the provider returned null for the conceptual schema definition, return the default one
                if (informationType == ConceptualSchemaDefinitionVersion3 ||
                    informationType == ConceptualSchemaDefinition)
                {
                    return(DbProviderServices.GetConceptualSchemaDefinition(informationType));
                }

                throw EntityUtil.ProviderIncompatible(System.Data.Entity.Strings.ProviderReturnedNullForGetDbInformation(informationType));
            }
            return(reader);
        }