示例#1
0
        internal AsyncDatabaseConnectionImpl(SQLiteDatabaseConnection conn, IScheduler scheduler, WriteLockedRef <bool> progressHandlerResult)
        {
            this.conn                  = conn;
            this.scheduler             = scheduler;
            this.progressHandlerResult = progressHandlerResult;

            this.Trace   = Observable.FromEventPattern <DatabaseTraceEventArgs>(conn, "Trace").Select(e => e.EventArgs);
            this.Profile = Observable.FromEventPattern <DatabaseProfileEventArgs>(conn, "Profile").Select(e => e.EventArgs);
            this.Update  = Observable.FromEventPattern <DatabaseUpdateEventArgs>(conn, "Update").Select(e => e.EventArgs);
        }
示例#2
0
        /// <summary>
        /// Builds an IAsyncDatabaseConnection using the specified scheduler.
        /// </summary>
        /// <returns>An IAsyncDatabaseConnection using the specified scheduler.</returns>
        /// <param name="This">A SQLiteDatabaseConnectionBuilder instance.</param>
        /// <param name="scheduler">An RX scheduler</param>
        public static IAsyncDatabaseConnection BuildAsyncDatabaseConnection(
            this SQLiteDatabaseConnectionBuilder This,
            IScheduler scheduler)
        {
            Contract.Requires(This != null);
            Contract.Requires(scheduler != null);

            var progressHandlerResult = new WriteLockedRef <bool>(false);
            var db = This.With(progressHandler: () => progressHandlerResult.Value).Build();

            return(new AsyncDatabaseConnectionImpl(db, scheduler, progressHandlerResult));
        }