/// <summary> /// Obtain a session which is designed to be used through <see cref="System.Reactive"/> with /// the specified access mode. /// </summary> /// <param name="driver">driver instance</param> /// <param name="action">An action, provided with a <see cref="SessionConfigBuilder"/> instance, that should populate /// the provided instance with desired session configurations <see cref="SessionConfig"/>.</param> /// <returns>A reactive session instance</returns> public static IRxSession RxSession(this IDriver driver, Action <SessionConfigBuilder> action) { var reactiveDriver = driver.CastOrThrow <IInternalDriver>(); return(new InternalRxSession(reactiveDriver.Session(action, true), new RxRetryLogic(reactiveDriver.Config.MaxTransactionRetryTime, reactiveDriver.Config.Logger))); }
/// <summary> /// Obtain a session which is designed to be used through <see cref="System.Reactive"/> with /// the specified access mode and bookmarks. /// </summary> /// <param name="driver">driver instance</param> /// <param name="mode">access mode for the returned session</param> /// <param name="bookmarks">bookmarks to establish causal chaining</param> /// <returns>A reactive session instance</returns> public static IRxSession RxSession(this IDriver driver, AccessMode mode, IEnumerable <string> bookmarks) { var reactiveDriver = driver.CastOrThrow <IInternalDriver>(); return(new InternalRxSession(reactiveDriver.Session(mode, bookmarks, true), new RxRetryLogic(reactiveDriver.Config.MaxTransactionRetryTime, reactiveDriver.Config.DriverLogger))); }
/// <summary> /// Obtain a session which is designed to be used synchronously, which is built on top of the default /// asynchronous <see cref="IAsyncSession"/> with the customized <see cref="SessionConfig"/>. /// </summary> /// <param name="driver">driver instance</param> /// <param name="action">An action, provided with a <see cref="SessionConfigBuilder"/> instance, that should populate /// the provided instance with desired session configurations <see cref="SessionConfig"/>.</param> /// <returns>A simple session instance</returns> public static ISession Session(this IDriver driver, Action <SessionConfigBuilder> action) { var asyncDriver = driver.CastOrThrow <IInternalDriver>(); return(new InternalSession(driver.AsyncSession(action).CastOrThrow <IInternalAsyncSession>(), new RetryLogic(asyncDriver.Config.MaxTransactionRetryTime, asyncDriver.Config.Logger), new BlockingExecutor())); }
/// <summary> /// Obtain a session which is designed to be used synchronously, which is built on top of the default /// asynchronous <see cref="IAsyncSession"/> with the specified access mode and bookmarks. /// </summary> /// <param name="driver">driver instance</param> /// <param name="mode">access mode for the returned session</param> /// <param name="bookmarks">bookmarks to establish causal chaining</param> /// <returns>A reactive session instance</returns> public static ISession Session(this IDriver driver, AccessMode mode, IEnumerable <string> bookmarks) { var reactiveDriver = driver.CastOrThrow <IInternalDriver>(); return(new InternalSession(driver.AsyncSession(mode, bookmarks).CastOrThrow <IInternalAsyncSession>(), new RetryLogic(reactiveDriver.Config.MaxTransactionRetryTime, reactiveDriver.Config.DriverLogger), new BlockingExecutor())); }