コード例 #1
0
        /// <summary>
        /// Creates a new <see cref="ClusterSymbol"/> with database added or replacing an existing database with the same name.
        /// </summary>
        public ClusterSymbol AddOrUpdateDatabase(DatabaseSymbol newDatabase)
        {
            var existingDatabase = this.GetDatabase(newDatabase.Name);

            if (existingDatabase != null)
            {
                return(this.UpdateDatabase(existingDatabase, newDatabase));
            }
            else
            {
                return(this.AddDatabase(newDatabase));
            }
        }
コード例 #2
0
        /// <summary>
        /// Creates a new <see cref="ClusterSymbol"/> with the specified database added.
        /// </summary>
        public ClusterSymbol AddDatabase(DatabaseSymbol database)
        {
            var newDatabases = this.Databases.Concat(new[] { database });

            return(new ClusterSymbol(this.Name, newDatabases, this.IsOpen));
        }
コード例 #3
0
        /// <summary>
        /// Creates a new <see cref="ClusterSymbol"/> with existing database replaced with the new database.
        /// </summary>
        public ClusterSymbol UpdateDatabase(DatabaseSymbol existingDatabase, DatabaseSymbol newDatabase)
        {
            var newDatabases = this.Databases.Select(d => d == existingDatabase ? newDatabase : d);

            return(new ClusterSymbol(this.Name, newDatabases, this.IsOpen));
        }
コード例 #4
0
        /// <summary>
        /// Creates a new <see cref="ClusterSymbol"/> with the specified database removed.
        /// </summary>
        public ClusterSymbol RemoveDatabase(DatabaseSymbol symbolToRemove)
        {
            var newDatabases = this.Databases.Where(d => d != symbolToRemove).ToReadOnly();

            return(new ClusterSymbol(this.Name, newDatabases, this.IsOpen));
        }