Esempio n. 1
0
        /// <summary>
        /// Converts the class to a NATIVE_COMMIT_ID structure.
        /// </summary>
        /// <returns>A NATIVE_COMMIT_ID structure.</returns>
        internal NATIVE_COMMIT_ID GetNativeCommitId()
        {
            NATIVE_COMMIT_ID native = new NATIVE_COMMIT_ID();

            native.signLog  = this.signLog.GetNativeSignature();
            native.commitId = checked ((long)this.commitId);

            return(native);
        }
        /// <summary>
        /// The proxy callback function to call the user-defined managed delegate.
        /// </summary>
        /// <param name="instance">
        /// The instance.
        /// </param>
        /// <param name="commitIdSeen">
        /// The commit-id flushed.
        /// </param>
        /// <param name="grbit">
        /// Reserved currently.
        /// </param>
        /// <returns>
        /// An error code.
        /// </returns>
        private JET_err NativeDurableCommitCallback(
            IntPtr instance,
            ref NATIVE_COMMIT_ID commitIdSeen,
            uint grbit)
        {
            RuntimeHelpers.PrepareConstrainedRegions();
            try
            {
                JET_INSTANCE jetInstance = new JET_INSTANCE()
                {
                    Value = instance
                };

                if (this.instance != jetInstance)
                {
                    // We assume it's only called on one instance at a time. The only thing
                    // we really care about is serialization of the byte array.
                    //
                    // It would be nice to throw an error, but we're going back to real
                    // code, which doesn't deal with managed exceptions well.
                    return(JET_err.CallbackFailed);
                }

                JET_COMMIT_ID commitId = new JET_COMMIT_ID(commitIdSeen);

                return(this.wrappedCallback(jetInstance, commitId, (DurableCommitCallbackGrbit)grbit));
            }
            catch (Exception ex)
            {
                Trace.WriteLineIf(
                    TraceSwitch.TraceWarning, string.Format(CultureInfo.InvariantCulture, "Caught Exception {0}", ex));

                JetApi.ReportUnhandledException(ex, "Unhandled exception during NativeDurableCommitCallback");

                // This should never be executed, but the compiler doesn't know it.
                return(JET_err.CallbackFailed);
            }
        }
Esempio n. 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="JET_COMMIT_ID"/> class.
 /// </summary>
 /// <param name="native">The native version of the structure.
 /// to use as the data source.</param>
 internal JET_COMMIT_ID(NATIVE_COMMIT_ID native)
 {
     this.signLog  = new JET_SIGNATURE(native.signLog);
     this.commitId = native.commitId;
 }