/// <summary>
        /// Initializes a new instance of the <see cref="DurableCommitCallback"/> class.
        /// The constructor.
        /// </summary>
        /// <param name="instance">
        /// The instance with which to associate the callback.
        /// </param>
        /// <param name="wrappedCallback">
        /// The managed code callback to call.
        /// </param>
        public DurableCommitCallback(
            JET_INSTANCE instance,
            JET_PFNDURABLECOMMITCALLBACK wrappedCallback)
        {
            this.instance        = instance;
            this.wrappedCallback = wrappedCallback;
            this.wrapperCallback = this.NativeDurableCommitCallback;

#if !MANAGEDESENT_ON_WSA // RuntimeHelpers works differently in Windows Store Apps.
            if (this.wrappedCallback != null)
            {
                RuntimeHelpers.PrepareMethod(this.wrappedCallback.Method.MethodHandle);
            }

            RuntimeHelpers.PrepareMethod(typeof(DurableCommitCallback).GetMethod("NativeDurableCommitCallback", BindingFlags.NonPublic | BindingFlags.Instance).MethodHandle);
#endif

            InstanceParameters instanceParameters = new InstanceParameters(this.instance);

            // This might be null.
            instanceParameters.SetDurableCommitCallback(this.wrapperCallback);

            this.ResourceWasAllocated();
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="DurableCommitCallback"/> class. 
        /// The constructor.
        /// </summary>
        /// <param name="instance">
        /// The instance with which to associate the callback.
        /// </param>
        /// <param name="wrappedCallback">
        /// The managed code callback to call.
        /// </param>
        public DurableCommitCallback(
            JET_INSTANCE instance,
            JET_PFNDURABLECOMMITCALLBACK wrappedCallback)
        {
            this.instance = instance;
            this.wrappedCallback = wrappedCallback;
            this.wrapperCallback = this.NativeDurableCommitCallback;

            #if !MANAGEDESENT_ON_WSA // RuntimeHelpers works differently in Windows Store Apps.
            if (this.wrappedCallback != null)
            {
                RuntimeHelpers.PrepareMethod(this.wrappedCallback.Method.MethodHandle);
            }

            RuntimeHelpers.PrepareMethod(typeof(DurableCommitCallback).GetMethod("NativeDurableCommitCallback", BindingFlags.NonPublic | BindingFlags.Instance).MethodHandle);
            #endif

            InstanceParameters instanceParameters = new InstanceParameters(this.instance);

            // This might be null.
            instanceParameters.SetDurableCommitCallback(this.wrapperCallback);

            this.ResourceWasAllocated();
        }