public void TestJetStopServiceInstance2StopsSubsequentOperations() { if (!EsentVersion.SupportsWindows8Features) { return; } using (var instance = new Instance("TestJetStopServiceInstance")) { instance.Parameters.Recovery = false; instance.Parameters.NoInformationEvent = true; instance.Parameters.MaxTemporaryTables = 0; instance.Init(); StopServiceGrbit[] resumableGrbits = new StopServiceGrbit[] { StopServiceGrbit.QuiesceCaches, StopServiceGrbit.BackgroundUserTasks, }; foreach (StopServiceGrbit grbit in resumableGrbits) { JET_SESID sesid; Windows8Api.JetStopServiceInstance2(instance, grbit); try { Api.JetBeginSession(instance, out sesid, null, null); Api.JetEndSession(sesid, EndSessionGrbit.None); } catch (EsentClientRequestToStopJetServiceException) { Assert.Fail("JetBeginSession should not have thrown an exception when the service is stopped with {0}.", grbit); } // Resuming the service should allow BeginSession to work. Windows8Api.JetStopServiceInstance2(instance, StopServiceGrbit.Resume); Api.JetBeginSession(instance, out sesid, null, null); Api.JetEndSession(sesid, EndSessionGrbit.None); } } }
/// <summary> /// Prepares an instance for termination. Can also be used to resume a previous quiescing. /// </summary> /// <param name="instance">The (running) instance to use.</param> /// <param name="grbit">The options to stop or resume the instance.</param> public static void JetStopServiceInstance2( JET_INSTANCE instance, StopServiceGrbit grbit) { Api.Check(Api.Impl.JetStopServiceInstance2(instance, grbit)); }
/// <summary> /// Prepares an instance for termination. Can also be used to resume a previous quiescing. /// </summary> /// <param name="instance">The (running) instance to use.</param> /// <param name="grbit">The options to stop or resume the instance.</param> public static void JetStopServiceInstance2( JET_INSTANCE instance, StopServiceGrbit grbit) { Api.Check(Api.Impl.JetStopServiceInstance2(instance, grbit)); }