Ejemplo n.º 1
0
        /// <summary>
        ///     Deletes all store objects specified in the store item collection from the
        ///     database and the database itself.
        /// </summary>
        /// <param name="connection">
        ///     Connection to an existing database that needs to be deleted.
        /// </param>
        /// <param name="commandTimeout">
        ///     Execution timeout for any commands needed to delete the database.
        /// </param>
        /// <param name="storeItemCollection">
        ///     The structure of the database to be deleted.
        /// </param>
        protected override void DbDeleteDatabase(
            DbConnection connection,
            int?commandTimeout,
            StoreItemCollection storeItemCollection)
        {
            EffortConnectionStringBuilder connectionString =
                new EffortConnectionStringBuilder(connection.ConnectionString);

            DbContainerStore.RemoveDbContainer(connectionString.InstanceId);
        }
Ejemplo n.º 2
0
        /// <summary>
        ///     Opens a database connection with the settings specified by the
        ///     <see cref="P:System.Data.Common.DbConnection.ConnectionString" />.
        /// </summary>
        public override void Open()
        {
            EffortConnectionStringBuilder connectionString =
                new EffortConnectionStringBuilder(this.ConnectionString);

            string instanceId = connectionString.InstanceId;

            if (this.lastContainerId == instanceId)
            {
                // The id was not changed, so the appropriate container is associated
                this.ChangeConnectionState(ConnectionState.Open);
                return;
            }

            this.container =
                DbContainerStore.GetDbContainer(instanceId, this.CreateDbContainer);

            this.containerConfiguration = new DbContainerManagerWrapper(this.container);

            this.lastContainerId = instanceId;
            this.ChangeConnectionState(ConnectionState.Open);
        }
Ejemplo n.º 3
0
        internal virtual void UnregisterContainer()
        {
            var builder = new EffortConnectionStringBuilder(this.ConnectionString);

            DbContainerStore.RemoveDbContainer(builder.InstanceId);
        }