示例#1
0
        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);
                }
            }
        }
示例#2
0
 /// <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));
 }
示例#3
0
 /// <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));
 }