Example #1
0
        /// <summary>
        /// API constructor, instead use <see cref="DiscoveredServer.ExpectDatabase"/> instead.
        /// </summary>
        /// <param name="server"></param>
        /// <param name="database"></param>
        /// <param name="querySyntaxHelper"></param>
        internal DiscoveredDatabase(DiscoveredServer server, string database, IQuerySyntaxHelper querySyntaxHelper)
        {
            Server             = server;
            _database          = database;
            _querySyntaxHelper = querySyntaxHelper;
            Helper             = server.Helper.GetDatabaseHelper();

            _querySyntaxHelper.ValidateDatabaseName(database);
        }
Example #2
0
        /// <summary>
        /// <para>Creates an expectation (See <see cref="IMightNotExist"/>) that there is a database with the given name on the server.
        /// This method does not query the database or confirm it exists.</para>
        ///
        /// <para>See also <see cref="DiscoveredDatabase.Exists"/>, <see cref="DiscoveredDatabase.Create"/> etc </para>
        /// </summary>
        /// <param name="database"></param>
        /// <returns></returns>
        public DiscoveredDatabase ExpectDatabase(string database)
        {
            GetQuerySyntaxHelper().ValidateDatabaseName(database);

            var builder = Helper.ChangeDatabase(Builder, database);
            var server  = new DiscoveredServer(builder);

            return(new DiscoveredDatabase(server, database, Helper.GetQuerySyntaxHelper()));
        }
Example #3
0
        /// <summary>
        /// Equality based on Builder.ConnectionString and DatabaseType
        /// </summary>
        /// <param name="other"></param>
        /// <returns></returns>
        protected bool Equals(DiscoveredServer other)
        {
            if (Builder == null || other.Builder == null)
            {
                return(Equals(Builder, other.Builder) && DatabaseType == other.DatabaseType);
            }

            //server is the same if they are pointed at the same server
            return(string.Equals(Builder.ConnectionString, other.Builder.ConnectionString, StringComparison.OrdinalIgnoreCase) && DatabaseType == other.DatabaseType);
        }
 public abstract Version GetVersion(DiscoveredServer server);