//-----------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation.
//
//-----------------------------------------------------------------------
namespace Microsoft.Isam.Esent.Interop.Windows8
{
using System;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Runtime.InteropServices;
using Microsoft.Isam.Esent.Interop.Implementation;
///
/// The native version of the 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_INDEX_RANGE
{
///
/// The column values for the start of the index.
///
public IntPtr rgStartColumns;
///
/// Number of column values for the start of the index.
///
public uint cStartColumns;
///
/// The column values for the end of the index.
///
public IntPtr rgEndColumns;
///
/// Number of column values for the end of the index.
///
public uint cEndColumns;
}
///
/// Contains definition for .
///
[SuppressMessage(
"Microsoft.StyleCop.CSharp.NamingRules",
"SA1300:ElementMustBeginWithUpperCaseLetter",
Justification = "This should match the unmanaged API, which isn't capitalized.")]
public class JET_INDEX_RANGE
{
///
/// Gets or sets the column values for the start of the index.
///
public JET_INDEX_COLUMN[] startColumns { get; set; }
///
/// Gets or sets the column values for the end of the index.
///
public JET_INDEX_COLUMN[] endColumns { get; set; }
///
/// Returns a that represents the current .
///
///
/// A that represents the current .
///
public override string ToString()
{
return string.Format(CultureInfo.InvariantCulture, "JET_INDEX_RANGE");
}
///
/// Gets the NATIVE_indexcolumn structure that represents the object.
///
/// GC handle collection to add any pinned handles.
/// The NATIVE_indexcolumn structure.
internal NATIVE_INDEX_RANGE GetNativeIndexRange(ref GCHandleCollection handles)
{
NATIVE_INDEX_RANGE indexRange = new NATIVE_INDEX_RANGE();
NATIVE_INDEX_COLUMN[] nativeColumns;
if (this.startColumns != null)
{
nativeColumns = new NATIVE_INDEX_COLUMN[this.startColumns.Length];
for (int i = 0; i < this.startColumns.Length; i++)
{
nativeColumns[i] = this.startColumns[i].GetNativeIndexColumn(ref handles);
}
indexRange.rgStartColumns = handles.Add(nativeColumns);
indexRange.cStartColumns = (uint)this.startColumns.Length;
}
if (this.endColumns != null)
{
nativeColumns = new NATIVE_INDEX_COLUMN[this.endColumns.Length];
for (int i = 0; i < this.endColumns.Length; i++)
{
nativeColumns[i] = this.endColumns[i].GetNativeIndexColumn(ref handles);
}
indexRange.rgEndColumns = handles.Add(nativeColumns);
indexRange.cEndColumns = (uint)this.endColumns.Length;
}
return indexRange;
}
}
}