//-----------------------------------------------------------------------
// 
//     Copyright (c) Microsoft Corporation.
// 
//-----------------------------------------------------------------------
namespace Microsoft.Isam.Esent.Interop
{
    using System;
    using System.Diagnostics;
    using System.Globalization;
    using System.Runtime.InteropServices;
    /// 
    /// A JET_INSTANCE contains a handle to the instance of the database to use for calls to the JET Api.
    /// 
    public struct JET_INSTANCE : IEquatable, IFormattable
    {
        /// 
        /// The native value.
        /// 
        internal IntPtr Value;
        /// 
        /// Gets a null JET_INSTANCE.
        /// 
        public static JET_INSTANCE Nil
        {
            [DebuggerStepThrough]
            get { return new JET_INSTANCE(); }
        }
        /// 
        /// Gets a value indicating whether the  is valid (checks against 0 and -1).
        /// 
        public bool IsInvalid
        {
            get { return this.Value == IntPtr.Zero || this.Value == new IntPtr(~0); }
        }
        /// 
        /// Determines whether two specified instances of JET_INSTANCE
        /// are equal.
        /// 
        /// The first instance to compare.
        /// The second instance to compare.
        /// True if the two instances are equal.
        public static bool operator ==(JET_INSTANCE lhs, JET_INSTANCE rhs)
        {
            return lhs.Value == rhs.Value;
        }
        /// 
        /// Determines whether two specified instances of JET_INSTANCE
        /// are not equal.
        /// 
        /// The first instance to compare.
        /// The second instance to compare.
        /// True if the two instances are not equal.
        public static bool operator !=(JET_INSTANCE lhs, JET_INSTANCE rhs)
        {
            return !(lhs == rhs);
        }
        /// 
        /// Generate a string representation of the structure.
        /// 
        /// The structure as a string.
        public override string ToString()
        {
            return string.Format(CultureInfo.InvariantCulture, "JET_INSTANCE(0x{0:x})", this.Value.ToInt64());
        }
        /// 
        /// Formats the value of the current instance using the specified format.
        /// 
        /// 
        /// A  containing the value of the current instance in the specified format.
        /// 
        /// The  specifying the format to use.
        /// -or-
        /// null to use the default format defined for the type of the  implementation.
        /// 
        /// The  to use to format the value.
        /// -or-
        /// null to obtain the numeric format information from the current locale setting of the operating system.
        /// 
        public string ToString(string format, IFormatProvider formatProvider)
        {
            return string.IsNullOrEmpty(format) || "G" == format ? this.ToString() : this.Value.ToInt64().ToString(format, formatProvider);
        }
        /// 
        /// Returns a value indicating whether this instance is equal
        /// to another instance.
        /// 
        /// An object to compare with this instance.
        /// True if the two instances are equal.
        public override bool Equals(object obj)
        {
            if (obj == null || GetType() != obj.GetType())
            {
                return false;
            }
            return this.Equals((JET_INSTANCE)obj);
        }
        /// 
        /// Returns the hash code for this instance.
        /// 
        /// The hash code for this instance.
        public override int GetHashCode()
        {
            return this.Value.GetHashCode();
        }
        /// 
        /// Returns a value indicating whether this instance is equal
        /// to another instance.
        /// 
        /// An instance to compare with this instance.
        /// True if the two instances are equal.
        public bool Equals(JET_INSTANCE other)
        {
            return this.Value.Equals(other.Value);
        }
    }
    /// 
    /// A JET_SESID contains a handle to the session to use for calls to the JET Api.
    /// 
    public struct JET_SESID : IEquatable, IFormattable
    {
        /// 
        /// The native value.
        /// 
        internal IntPtr Value;
        /// 
        /// Gets a null JET_SESID.
        /// 
        public static JET_SESID Nil
        {
            [DebuggerStepThrough]
            get { return new JET_SESID(); }
        }
        /// 
        /// Gets a value indicating whether the  is valid (checks against 0 and -1).
        /// 
        public bool IsInvalid
        {
            get { return this.Value == IntPtr.Zero || this.Value == new IntPtr(~0); }
        }
        /// 
        /// Determines whether two specified instances of JET_SESID
        /// are equal.
        /// 
        /// The first instance to compare.
        /// The second instance to compare.
        /// True if the two instances are equal.
        public static bool operator ==(JET_SESID lhs, JET_SESID rhs)
        {
            return lhs.Value == rhs.Value;
        }
        /// 
        /// Determines whether two specified instances of JET_SESID
        /// are not equal.
        /// 
        /// The first instance to compare.
        /// The second instance to compare.
        /// True if the two instances are not equal.
        public static bool operator !=(JET_SESID lhs, JET_SESID rhs)
        {
            return !(lhs == rhs);
        }
        /// 
        /// Generate a string representation of the structure.
        /// 
        /// The structure as a string.
        public override string ToString()
        {
            return string.Format(CultureInfo.InvariantCulture, "JET_SESID(0x{0:x})", this.Value.ToInt64());
        }
        /// 
        /// Formats the value of the current instance using the specified format.
        /// 
        /// 
        /// A  containing the value of the current instance in the specified format.
        /// 
        /// The  specifying the format to use.
        /// -or-
        /// null to use the default format defined for the type of the  implementation.
        /// 
        /// The  to use to format the value.
        /// -or-
        /// null to obtain the numeric format information from the current locale setting of the operating system.
        /// 
        public string ToString(string format, IFormatProvider formatProvider)
        {
            return string.IsNullOrEmpty(format) || "G" == format ? this.ToString() : this.Value.ToInt64().ToString(format, formatProvider);
        }
        /// 
        /// Returns a value indicating whether this instance is equal
        /// to another instance.
        /// 
        /// An object to compare with this instance.
        /// True if the two instances are equal.
        public override bool Equals(object obj)
        {
            if (obj == null || GetType() != obj.GetType())
            {
                return false;
            }
            return this.Equals((JET_SESID)obj);
        }
        /// 
        /// Returns the hash code for this instance.
        /// 
        /// The hash code for this instance.
        public override int GetHashCode()
        {
            return this.Value.GetHashCode();
        }
        /// 
        /// Returns a value indicating whether this instance is equal
        /// to another instance.
        /// 
        /// An instance to compare with this instance.
        /// True if the two instances are equal.
        public bool Equals(JET_SESID other)
        {
            return this.Value.Equals(other.Value);
        }
    }
    /// 
    /// A JET_TABLEID contains a handle to the database cursor to use for a call to the JET Api.
    /// A cursor can only be used with the session that was used to open that cursor.
    /// 
    public struct JET_TABLEID : IEquatable, IFormattable
    {
        /// 
        /// The native value.
        /// 
        internal IntPtr Value;
        /// 
        /// Gets a null JET_TABLEID.
        /// 
        public static JET_TABLEID Nil
        {
            [DebuggerStepThrough]
            get { return new JET_TABLEID(); }
        }
        /// 
        /// Gets a value indicating whether the  is valid (checks against 0 and -1).
        /// 
        public bool IsInvalid
        {
            get { return this.Value == IntPtr.Zero || this.Value == new IntPtr(~0); }
        }
        /// 
        /// Determines whether two specified instances of JET_TABLEID
        /// are equal.
        /// 
        /// The first instance to compare.
        /// The second instance to compare.
        /// True if the two instances are equal.
        public static bool operator ==(JET_TABLEID lhs, JET_TABLEID rhs)
        {
            return lhs.Value == rhs.Value;
        }
        /// 
        /// Determines whether two specified instances of JET_TABLEID
        /// are not equal.
        /// 
        /// The first instance to compare.
        /// The second instance to compare.
        /// True if the two instances are not equal.
        public static bool operator !=(JET_TABLEID lhs, JET_TABLEID rhs)
        {
            return !(lhs == rhs);
        }
        /// 
        /// Generate a string representation of the structure.
        /// 
        /// The structure as a string.
        public override string ToString()
        {
            return string.Format(CultureInfo.InvariantCulture, "JET_TABLEID(0x{0:x})", this.Value.ToInt64());
        }
        /// 
        /// Formats the value of the current instance using the specified format.
        /// 
        /// 
        /// A  containing the value of the current instance in the specified format.
        /// 
        /// The  specifying the format to use.
        /// -or-
        /// null to use the default format defined for the type of the  implementation.
        /// 
        /// The  to use to format the value.
        /// -or-
        /// null to obtain the numeric format information from the current locale setting of the operating system.
        /// 
        public string ToString(string format, IFormatProvider formatProvider)
        {
            return string.IsNullOrEmpty(format) || "G" == format ? this.ToString() : this.Value.ToInt64().ToString(format, formatProvider);
        }
        /// 
        /// Returns a value indicating whether this instance is equal
        /// to another instance.
        /// 
        /// An object to compare with this instance.
        /// True if the two instances are equal.
        public override bool Equals(object obj)
        {
            if (obj == null || GetType() != obj.GetType())
            {
                return false;
            }
            return this.Equals((JET_TABLEID)obj);
        }
        /// 
        /// Returns the hash code for this instance.
        /// 
        /// The hash code for this instance.
        public override int GetHashCode()
        {
            return this.Value.GetHashCode();
        }
        /// 
        /// Returns a value indicating whether this instance is equal
        /// to another instance.
        /// 
        /// An instance to compare with this instance.
        /// True if the two instances are equal.
        public bool Equals(JET_TABLEID other)
        {
            return this.Value.Equals(other.Value);
        }
    }
    /// 
    /// A JET_DBID contains the handle to the database. A database handle is used to manage the
    /// schema of a database. It can also be used to manage the tables inside of that database.
    /// 
    public struct JET_DBID : IEquatable, IFormattable
    {
        /// 
        /// The native value.
        /// 
        internal uint Value;
        /// 
        /// Gets a null JET_DBID.
        /// 
        public static JET_DBID Nil
        {
            get
            {
                return new JET_DBID { Value = 0xffffffff };
            }
        }
        /// 
        /// Determines whether two specified instances of JET_DBID
        /// are equal.
        /// 
        /// The first instance to compare.
        /// The second instance to compare.
        /// True if the two instances are equal.
        public static bool operator ==(JET_DBID lhs, JET_DBID rhs)
        {
            return lhs.Value == rhs.Value;
        }
        /// 
        /// Determines whether two specified instances of JET_DBID
        /// are not equal.
        /// 
        /// The first instance to compare.
        /// The second instance to compare.
        /// True if the two instances are not equal.
        public static bool operator !=(JET_DBID lhs, JET_DBID rhs)
        {
            return !(lhs == rhs);
        }
        /// 
        /// Generate a string representation of the structure.
        /// 
        /// The structure as a string.
        public override string ToString()
        {
            return string.Format(CultureInfo.InvariantCulture, "JET_DBID({0})", this.Value);
        }
        /// 
        /// Formats the value of the current instance using the specified format.
        /// 
        /// 
        /// A  containing the value of the current instance in the specified format.
        /// 
        /// The  specifying the format to use.
        /// -or-
        /// null to use the default format defined for the type of the  implementation.
        /// 
        /// The  to use to format the value.
        /// -or-
        /// null to obtain the numeric format information from the current locale setting of the operating system.
        /// 
        public string ToString(string format, IFormatProvider formatProvider)
        {
            return string.IsNullOrEmpty(format) || "G" == format ? this.ToString() : this.Value.ToString(format, formatProvider);
        }
        /// 
        /// Returns a value indicating whether this instance is equal
        /// to another instance.
        /// 
        /// An object to compare with this instance.
        /// True if the two instances are equal.
        public override bool Equals(object obj)
        {
            if (obj == null || GetType() != obj.GetType())
            {
                return false;
            }
            return this.Equals((JET_DBID)obj);
        }
        /// 
        /// Returns the hash code for this instance.
        /// 
        /// The hash code for this instance.
        public override int GetHashCode()
        {
            return this.Value.GetHashCode();
        }
        /// 
        /// Returns a value indicating whether this instance is equal
        /// to another instance.
        /// 
        /// An instance to compare with this instance.
        /// True if the two instances are equal.
        public bool Equals(JET_DBID other)
        {
            return this.Value.Equals(other.Value);
        }
    }
    /// 
    /// A JET_COLUMNID identifies a column within a table.
    /// 
    public struct JET_COLUMNID : IEquatable, IComparable, IFormattable
    {
        /// 
        /// The native value.
        /// 
        internal uint Value;
        /// 
        /// Gets a null JET_COLUMNID.
        /// 
        public static JET_COLUMNID Nil
        {
            [DebuggerStepThrough]
            get { return new JET_COLUMNID(); }
        }
        /// 
        /// Gets a value indicating whether the  is valid (checks against 0 and -1).
        /// 
        public bool IsInvalid
        {
            get { return this.Value == 0 || this.Value == 0xffffffff; }
        }
        /// 
        /// Determines whether two specified instances of JET_COLUMNID
        /// are equal.
        /// 
        /// The first instance to compare.
        /// The second instance to compare.
        /// True if the two instances are equal.
        public static bool operator ==(JET_COLUMNID lhs, JET_COLUMNID rhs)
        {
            return lhs.Value == rhs.Value;
        }
        /// 
        /// Determines whether two specified instances of JET_COLUMNID
        /// are not equal.
        /// 
        /// The first instance to compare.
        /// The second instance to compare.
        /// True if the two instances are not equal.
        public static bool operator !=(JET_COLUMNID lhs, JET_COLUMNID rhs)
        {
            return !(lhs == rhs);
        }
        /// 
        /// Determine whether one columnid is before another columnid.
        /// 
        /// The first columnid to compare.
        /// The second columnid to compare.
        /// True if lhs comes before rhs.
        public static bool operator <(JET_COLUMNID lhs, JET_COLUMNID rhs)
        {
            return lhs.Value < rhs.Value;
        }
        /// 
        /// Determine whether one columnid is after another columnid.
        /// 
        /// The first columnid to compare.
        /// The second columnid to compare.
        /// True if lhs comes after rhs.
        public static bool operator >(JET_COLUMNID lhs, JET_COLUMNID rhs)
        {
            return lhs.Value > rhs.Value;
        }
        /// 
        /// Determine whether one columnid is before or equal to
        /// another columnid.
        /// 
        /// The first columnid to compare.
        /// The second columnid to compare.
        /// True if lhs comes before or is equal to rhs.
        public static bool operator <=(JET_COLUMNID lhs, JET_COLUMNID rhs)
        {
            return lhs.Value <= rhs.Value;
        }
        /// 
        /// Determine whether one columnid is after or equal to
        /// another columnid.
        /// 
        /// The first columnid to compare.
        /// The second columnid to compare.
        /// True if lhs comes after or is equal to rhs.
        public static bool operator >=(JET_COLUMNID lhs, JET_COLUMNID rhs)
        {
            return lhs.Value >= rhs.Value;
        }
        /// 
        /// Generate a string representation of the structure.
        /// 
        /// The structure as a string.
        public override string ToString()
        {
            return string.Format(CultureInfo.InvariantCulture, "JET_COLUMNID(0x{0:x})", this.Value);
        }
        /// 
        /// Formats the value of the current instance using the specified format.
        /// 
        /// 
        /// A  containing the value of the current instance in the specified format.
        /// 
        /// The  specifying the format to use.
        /// -or-
        /// null to use the default format defined for the type of the  implementation.
        /// 
        /// The  to use to format the value.
        /// -or-
        /// null to obtain the numeric format information from the current locale setting of the operating system.
        /// 
        public string ToString(string format, IFormatProvider formatProvider)
        {
            return string.IsNullOrEmpty(format) || "G" == format ? this.ToString() : this.Value.ToString(format, formatProvider);
        }
        /// 
        /// Returns a value indicating whether this instance is equal
        /// to another instance.
        /// 
        /// An object to compare with this instance.
        /// True if the two instances are equal.
        public override bool Equals(object obj)
        {
            if (obj == null || GetType() != obj.GetType())
            {
                return false;
            }
            return this.Equals((JET_COLUMNID)obj);
        }
        /// 
        /// Returns the hash code for this instance.
        /// 
        /// The hash code for this instance.
        public override int GetHashCode()
        {
            return this.Value.GetHashCode();
        }
        /// 
        /// Returns a value indicating whether this instance is equal
        /// to another instance.
        /// 
        /// An instance to compare with this instance.
        /// True if the two instances are equal.
        public bool Equals(JET_COLUMNID other)
        {
            return this.Value.Equals(other.Value);
        }
        /// 
        /// Compares this columnid to another columnid and determines
        /// whether this instance is before, the same as or after the other
        /// instance.
        /// 
        /// The columnid to compare to the current instance.
        /// 
        /// A signed number indicating the relative positions of this instance and the value parameter.
        /// 
        public int CompareTo(JET_COLUMNID other)
        {
            return this.Value.CompareTo(other.Value);
        }
        /// 
        /// Creates a new instance of a  using the specified
        /// value as the underlying value.
        /// 
        /// The native ESE JET_COLUMNID.
        /// An initialized  structure.
        /// Use of this function should be exceedingly rare.
        internal static JET_COLUMNID CreateColumnidFromNativeValue(int nativeValue)
        {
            return new JET_COLUMNID()
            {
                Value = unchecked((uint)nativeValue)
            };
        }
    }
#if !MANAGEDESENT_ON_WSA // Not exposed in MSDK
    /// 
    /// A JET_OSSNAPID contains a handle to a snapshot of a database.
    /// 
    public struct JET_OSSNAPID : IEquatable, IFormattable
    {
        /// 
        /// The native value.
        /// 
        internal IntPtr Value;
        /// 
        /// Gets a null JET_OSSNAPID.
        /// 
        public static JET_OSSNAPID Nil
        {
            [DebuggerStepThrough]
            get { return new JET_OSSNAPID(); }
        }
        /// 
        /// Gets a value indicating whether the  is valid (checks against 0 and -1).
        /// 
        public bool IsInvalid
        {
            get { return this.Value == IntPtr.Zero || this.Value == new IntPtr(~0); }
        }
        /// 
        /// Determines whether two specified instances of JET_OSSNAPID
        /// are equal.
        /// 
        /// The first instance to compare.
        /// The second instance to compare.
        /// True if the two instances are equal.
        public static bool operator ==(JET_OSSNAPID lhs, JET_OSSNAPID rhs)
        {
            return lhs.Value == rhs.Value;
        }
        /// 
        /// Determines whether two specified instances of JET_OSSNAPID
        /// are not equal.
        /// 
        /// The first instance to compare.
        /// The second instance to compare.
        /// True if the two instances are not equal.
        public static bool operator !=(JET_OSSNAPID lhs, JET_OSSNAPID rhs)
        {
            return !(lhs == rhs);
        }
        /// 
        /// Generate a string representation of the structure.
        /// 
        /// The structure as a string.
        public override string ToString()
        {
            return string.Format(CultureInfo.InvariantCulture, "JET_OSSNAPID(0x{0:x})", this.Value.ToInt64());
        }
        /// 
        /// Formats the value of the current instance using the specified format.
        /// 
        /// 
        /// A  containing the value of the current instance in the specified format.
        /// 
        /// The  specifying the format to use.
        /// -or-
        /// null to use the default format defined for the type of the  implementation.
        /// 
        /// The  to use to format the value.
        /// -or-
        /// null to obtain the numeric format information from the current locale setting of the operating system.
        /// 
        public string ToString(string format, IFormatProvider formatProvider)
        {
            return string.IsNullOrEmpty(format) || "G" == format ? this.ToString() : this.Value.ToInt64().ToString(format, formatProvider);
        }
        /// 
        /// Returns a value indicating whether this instance is equal
        /// to another instance.
        /// 
        /// An object to compare with this instance.
        /// True if the two instances are equal.
        public override bool Equals(object obj)
        {
            if (obj == null || GetType() != obj.GetType())
            {
                return false;
            }
            return this.Equals((JET_OSSNAPID)obj);
        }
        /// 
        /// Returns the hash code for this instance.
        /// 
        /// The hash code for this instance.
        public override int GetHashCode()
        {
            return this.Value.GetHashCode();
        }
        /// 
        /// Returns a value indicating whether this instance is equal
        /// to another instance.
        /// 
        /// An instance to compare with this instance.
        /// True if the two instances are equal.
        public bool Equals(JET_OSSNAPID other)
        {
            return this.Value.Equals(other.Value);
        }
    }
#endif // !MANAGEDESENT_ON_WSA
    /// 
    /// A JET_HANDLE contains a generic handle.
    /// 
    public struct JET_HANDLE : IEquatable, IFormattable
    {
        /// 
        /// The native value.
        /// 
        internal IntPtr Value;
        /// 
        /// Gets a null JET_HANDLE.
        /// 
        public static JET_HANDLE Nil
        {
            [DebuggerStepThrough]
            get { return new JET_HANDLE(); }
        }
        /// 
        /// Gets a value indicating whether the  is valid (checks against 0 and -1).
        /// 
        public bool IsInvalid
        {
            get { return this.Value == IntPtr.Zero || this.Value == new IntPtr(~0); }
        }
        /// 
        /// Determines whether two specified instances of JET_HANDLE
        /// are equal.
        /// 
        /// The first instance to compare.
        /// The second instance to compare.
        /// True if the two instances are equal.
        public static bool operator ==(JET_HANDLE lhs, JET_HANDLE rhs)
        {
            return lhs.Value == rhs.Value;
        }
        /// 
        /// Determines whether two specified instances of JET_HANDLE
        /// are not equal.
        /// 
        /// The first instance to compare.
        /// The second instance to compare.
        /// True if the two instances are not equal.
        public static bool operator !=(JET_HANDLE lhs, JET_HANDLE rhs)
        {
            return !(lhs == rhs);
        }
        /// 
        /// Generate a string representation of the structure.
        /// 
        /// The structure as a string.
        public override string ToString()
        {
            return string.Format(CultureInfo.InvariantCulture, "JET_HANDLE(0x{0:x})", this.Value.ToInt64());
        }
        /// 
        /// Formats the value of the current instance using the specified format.
        /// 
        /// 
        /// A  containing the value of the current instance in the specified format.
        /// 
        /// The  specifying the format to use.
        /// -or-
        /// null to use the default format defined for the type of the  implementation.
        /// 
        /// The  to use to format the value.
        /// -or-
        /// null to obtain the numeric format information from the current locale setting of the operating system.
        /// 
        public string ToString(string format, IFormatProvider formatProvider)
        {
            return string.IsNullOrEmpty(format) || "G" == format ? this.ToString() : this.Value.ToInt64().ToString(format, formatProvider);
        }
        /// 
        /// Returns a value indicating whether this instance is equal
        /// to another instance.
        /// 
        /// An object to compare with this instance.
        /// True if the two instances are equal.
        public override bool Equals(object obj)
        {
            if (obj == null || GetType() != obj.GetType())
            {
                return false;
            }
            return this.Equals((JET_HANDLE)obj);
        }
        /// 
        /// Returns the hash code for this instance.
        /// 
        /// The hash code for this instance.
        public override int GetHashCode()
        {
            return this.Value.GetHashCode();
        }
        /// 
        /// Returns a value indicating whether this instance is equal
        /// to another instance.
        /// 
        /// An instance to compare with this instance.
        /// True if the two instances are equal.
        public bool Equals(JET_HANDLE other)
        {
            return this.Value.Equals(other.Value);
        }
    }
#if !MANAGEDESENT_ON_WSA
    /// 
    /// Local storage for an ESENT handle. Used by 
    /// and .
    /// 
    public struct JET_LS : IEquatable, IFormattable
    {
        /// 
        /// The null handle.
        /// 
        public static readonly JET_LS Nil = new JET_LS { Value = new IntPtr(~0) };
        /// 
        /// Gets a value indicating whether the  is valid (checks against 0 and -1).
        /// 
        public bool IsInvalid
        {
            get { return this.Value == IntPtr.Zero || this.Value == new IntPtr(~0); }
        }
        /// 
        /// Gets or sets the value of the handle.
        /// 
        public IntPtr Value { get; set; }
        /// 
        /// Determines whether two specified instances of JET_LS
        /// are equal.
        /// 
        /// The first instance to compare.
        /// The second instance to compare.
        /// True if the two instances are equal.
        public static bool operator ==(JET_LS lhs, JET_LS rhs)
        {
            return lhs.Value == rhs.Value;
        }
        /// 
        /// Determines whether two specified instances of JET_LS
        /// are not equal.
        /// 
        /// The first instance to compare.
        /// The second instance to compare.
        /// True if the two instances are not equal.
        public static bool operator !=(JET_LS lhs, JET_LS rhs)
        {
            return !(lhs == rhs);
        }
        /// 
        /// Generate a string representation of the structure.
        /// 
        /// The structure as a string.
        public override string ToString()
        {
            return string.Format(CultureInfo.InvariantCulture, "JET_LS(0x{0:x})", this.Value.ToInt64());
        }
        /// 
        /// Formats the value of the current instance using the specified format.
        /// 
        /// 
        /// A  containing the value of the current instance in the specified format.
        /// 
        /// The  specifying the format to use.
        /// -or-
        /// null to use the default format defined for the type of the  implementation.
        /// 
        /// The  to use to format the value.
        /// -or-
        /// null to obtain the numeric format information from the current locale setting of the operating system.
        /// 
        public string ToString(string format, IFormatProvider formatProvider)
        {
            return string.IsNullOrEmpty(format) || "G" == format ? this.ToString() : this.Value.ToInt64().ToString(format, formatProvider);
        }
        /// 
        /// Returns a value indicating whether this instance is equal
        /// to another instance.
        /// 
        /// An object to compare with this instance.
        /// True if the two instances are equal.
        public override bool Equals(object obj)
        {
            if (obj == null || GetType() != obj.GetType())
            {
                return false;
            }
            return this.Equals((JET_LS)obj);
        }
        /// 
        /// Returns the hash code for this instance.
        /// 
        /// The hash code for this instance.
        public override int GetHashCode()
        {
            return this.Value.GetHashCode();
        }
        /// 
        /// Returns a value indicating whether this instance is equal
        /// to another instance.
        /// 
        /// An instance to compare with this instance.
        /// True if the two instances are equal.
        public bool Equals(JET_LS other)
        {
            return this.Value.Equals(other.Value);
        }
    }
#endif // !MANAGEDESENT_ON_WSA
    /// 
    /// Holds an index ID. An index ID is a hint that is used to accelerate the
    /// selection of the current index using JetSetCurrentIndex. It is most
    /// useful when there is a very large number of indexes over a table. The
    /// index ID can be retrieved using JetGetIndexInfo or JetGetTableIndexInfo.
    /// 
    /// 
    /// The Pack attribute is necessary because the C++ version is defined as
    /// a byte array. If the C# compiler inserts the usual padding between the uint cbStruct
    ///  and the IntPtr, then the structure ends up too large.
    /// 
    [StructLayout(LayoutKind.Sequential, Pack = 4)]
    public struct JET_INDEXID : IEquatable
    {
        /// 
        /// Size of the structure.
        /// 
        internal uint CbStruct;
        /// 
        /// Internal use only.
        /// 
        internal IntPtr IndexId1;
        /// 
        /// Internal use only.
        /// 
        internal uint IndexId2;
        /// 
        /// Internal use only.
        /// 
        internal uint IndexId3;
        /// 
        /// The size of a JET_INDEXID structure.
        /// 
        private static readonly uint TheSizeOfIndexId = (uint)Marshal.SizeOf(typeof(JET_INDEXID));
        /// 
        /// Gets the size of a JET_INDEXINDEXID structure.
        /// 
        internal static uint SizeOfIndexId
        {
            [DebuggerStepThrough]
            get { return TheSizeOfIndexId; }
        }
        /// 
        /// Determines whether two specified instances of JET_INDEXID
        /// are equal.
        /// 
        /// The first instance to compare.
        /// The second instance to compare.
        /// True if the two instances are equal.
        public static bool operator ==(JET_INDEXID lhs, JET_INDEXID rhs)
        {
            return lhs.Equals(rhs);
        }
        /// 
        /// Determines whether two specified instances of JET_INDEXID
        /// are not equal.
        /// 
        /// The first instance to compare.
        /// The second instance to compare.
        /// True if the two instances are not equal.
        public static bool operator !=(JET_INDEXID lhs, JET_INDEXID rhs)
        {
            return !(lhs == rhs);
        }
        /// 
        /// Returns a value indicating whether this instance is equal
        /// to another instance.
        /// 
        /// An object to compare with this instance.
        /// True if the two instances are equal.
        public override bool Equals(object obj)
        {
            if (obj == null || GetType() != obj.GetType())
            {
                return false;
            }
            return this.Equals((JET_INDEXID)obj);
        }
        /// 
        /// Generate a string representation of the structure.
        /// 
        /// The structure as a string.
        public override string ToString()
        {
            return string.Format(
                CultureInfo.InvariantCulture,
                "JET_INDEXID(0x{0:x}:0x{1:x}:0x{2:x})",
                this.IndexId1,
                this.IndexId2,
                this.IndexId3);
        }
        /// 
        /// Returns the hash code for this instance.
        /// 
        /// The hash code for this instance.
        public override int GetHashCode()
        {
            return this.CbStruct.GetHashCode()
                   ^ this.IndexId1.GetHashCode()
                   ^ this.IndexId2.GetHashCode()
                   ^ this.IndexId3.GetHashCode();
        }
        /// 
        /// Returns a value indicating whether this instance is equal
        /// to another instance.
        /// 
        /// An instance to compare with this instance.
        /// True if the two instances are equal.
        public bool Equals(JET_INDEXID other)
        {
            return this.CbStruct == other.CbStruct
                   && this.IndexId1 == other.IndexId1
                   && this.IndexId2 == other.IndexId2
                   && this.IndexId3 == other.IndexId3;
        }
    }
}