/// <summary> /// Create a Resilient Unmanaged Database. /// </summary> /// <param name="database"> /// An <see cref="IUnmanagedBrowsingDatabase" /> to proxy to. /// </param> /// <param name="retryAttempts"> /// The number of attempts a failed operation should be retried. /// </param> /// <param name="ownDatabase"> /// A boolean flag indicating whether or not the resilient unmanaged database takes ownership of /// <paramref name="database" /> and disposes it when the resilient unmanaged database itself is disposed. /// If the resilient unmanaged database takes ownership of <paramref name="database" /> and you reference /// or dispose <paramref name="database" /> after you create the resilient unmanaged database, the behavior /// of the resilient unmanaged database and <paramref name="database" /> is undefined. /// </param> /// <exception cref="System.ArgumentNullException"> /// Thrown if <paramref name="database" /> is a null reference. /// </exception> /// <exception cref="System.ArgumentOutOfRangeException"> /// Thrown if <paramref name="retryAttempts" /> is less than or equal to <c>0</c>. /// </exception> public ResilientUnmanagedBrowsingDatabase(IUnmanagedBrowsingDatabase database, int retryAttempts, bool ownDatabase) : base(retryAttempts) { Guard.ThrowIf(nameof(retryAttempts), retryAttempts).LessThanOrEqualTo(0); this._database = UnmanagedBrowsingDatabaseProxy.Create(database, ownDatabase); this._disposed = false; this._ownDatabase = ownDatabase; }
/// <summary> /// Create an Unmanaged Database Proxy. /// </summary> /// <param name="database"> /// An <see cref="IUnmanagedBrowsingDatabase" /> to proxy to. The unmanaged database proxy takes ownership /// of <paramref name="database" /> and will dispose it when the unmanaged database proxy itself is /// disposed. If you reference or dispose <paramref name="database" /> after you create the unmanaged /// database proxy, the behavior of the unmanaged database proxy and <paramref name="database" /> is /// undefined. /// </param> /// <returns> /// An unmanaged database proxy. /// </returns> /// <exception cref="System.ArgumentNullException"> /// Thrown if <paramref name="database" /> is a null reference. /// </exception> internal static UnmanagedBrowsingDatabaseProxy Create(IUnmanagedBrowsingDatabase database) => UnmanagedBrowsingDatabaseProxy.Create(database, true);