//-----------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation.
//
//-----------------------------------------------------------------------
namespace Microsoft.Isam.Esent.Interop
{
using System;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Runtime.InteropServices;
///
/// The native version of the JET_SETINFO structure.
///
[StructLayout(LayoutKind.Sequential)]
[SuppressMessage("Microsoft.StyleCop.CSharp.NamingRules",
"SA1305:FieldNamesMustNotUseHungarianNotation",
Justification = "This should match the unmanaged API, which isn't capitalized.")]
[SuppressMessage(
"Microsoft.StyleCop.CSharp.NamingRules",
"SA1307:AccessibleFieldsMustBeginWithUpperCaseLetter",
Justification = "This should match the unmanaged API, which isn't capitalized.")]
internal struct NATIVE_SETINFO
{
///
/// The size of a NATIVE_SETINFO structure.
///
public static readonly int Size = Marshal.SizeOf(typeof(NATIVE_SETINFO));
///
/// Size of the structure.
///
public uint cbStruct;
///
/// Offset to the first byte to be set in a column of type JET_coltypLongBinary or JET_coltypLongText.
///
public uint ibLongValue;
///
/// The sequence number of value in a multi-valued column to be set.
///
public uint itagSequence;
}
///
/// Settings for JetSetColumn.
///
[SuppressMessage(
"Microsoft.StyleCop.CSharp.NamingRules",
"SA1300:ElementMustBeginWithUpperCaseLetter",
Justification = "This should match the unmanaged API, which isn't capitalized.")]
[Serializable]
public class JET_SETINFO : IContentEquatable, IDeepCloneable
{
///
/// Offset to the first byte to be set in a column of type or .
///
private int longValueOffset;
///
/// The sequence number of value in a multi-valued column to be set.
///
private int itag;
///
/// Gets or sets offset to the first byte to be set in a column of type or .
///
public int ibLongValue
{
get { return this.longValueOffset; }
set { this.longValueOffset = value; }
}
///
/// Gets or sets the sequence number of value in a multi-valued column to be set. The array of values is one-based.
/// The first value is sequence 1, not 0 (zero). If the record column has only one value then 1 should be passed
/// as the itagSequence if that value is being replaced. A value of 0 (zero) means to add a new column value instance
/// to the end of the sequence of column values.
///
public int itagSequence
{
get { return this.itag; }
set { this.itag = value; }
}
///
/// Returns a that represents the current .
///
///
/// A that represents the current .
///
public override string ToString()
{
return string.Format(
CultureInfo.InvariantCulture,
"JET_SETINFO(ibLongValue={0},itagSequence={1})",
this.ibLongValue,
this.itagSequence);
}
///
/// 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 ContentEquals(JET_SETINFO other)
{
if (null == other)
{
return false;
}
return this.ibLongValue == other.ibLongValue
&& this.itagSequence == other.itagSequence;
}
///
/// Returns a deep copy of the object.
///
/// A deep copy of the object.
public JET_SETINFO DeepClone()
{
return (JET_SETINFO)this.MemberwiseClone();
}
///
/// Gets the NATIVE_SETINFO structure that represents the object.
///
/// A NATIVE_SETINFO structure whose fields match the class.
internal NATIVE_SETINFO GetNativeSetinfo()
{
var setinfo = new NATIVE_SETINFO();
setinfo.cbStruct = checked((uint)NATIVE_SETINFO.Size);
setinfo.ibLongValue = checked((uint)this.ibLongValue);
setinfo.itagSequence = checked((uint)this.itagSequence);
return setinfo;
}
}
}