//----------------------------------------------------------------------- // // Copyright (c) Microsoft Corporation. // //----------------------------------------------------------------------- namespace Microsoft.Isam.Esent.Interop { using System; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Runtime.InteropServices; using Microsoft.Isam.Esent.Interop.Implementation; /// /// The native version of the structure. This includes callbacks, /// space hints, and uses NATIVE_INDEXCREATE4. /// [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 unsafe struct NATIVE_TABLECREATE4 { /// /// Size of the structure. /// public uint cbStruct; /// /// Name of the table to create. /// [MarshalAs(UnmanagedType.LPWStr)] public string szTableName; /// /// Name of the table from which to inherit base DDL. /// [MarshalAs(UnmanagedType.LPWStr)] public string szTemplateTableName; /// /// Initial pages to allocate for table. /// public uint ulPages; /// /// Table density. /// public uint ulDensity; /// /// Array of column creation info. /// public NATIVE_COLUMNCREATE* rgcolumncreate; /// /// Number of columns to create. /// public uint cColumns; /// /// Array of indices to create, pointer to . /// public IntPtr rgindexcreate; /// /// Number of indices to create. /// public uint cIndexes; /// /// Callback function to use for the table. /// [MarshalAs(UnmanagedType.LPWStr)] public string szCallback; /// /// Type of the callback function. /// public JET_cbtyp cbtyp; /// /// Table options. /// public uint grbit; /// /// Space allocation, maintenance, and usage hints for default sequential index. /// public NATIVE_SPACEHINTS* pSeqSpacehints; /// /// Space allocation, maintenance, and usage hints for Separated LV tree. /// public NATIVE_SPACEHINTS* pLVSpacehints; /// /// Heuristic size to separate a intrinsic LV from the primary record. /// public uint cbSeparateLV; /// /// Returned tableid. /// public IntPtr tableid; /// /// Count of objects created (columns+table+indexes+callbacks). /// public uint cCreated; } /// /// Contains the information needed to create a table in an ESE database. /// public partial class JET_TABLECREATE : IContentEquatable, IDeepCloneable { /// /// Gets the native (interop) version of this object. The following members are /// NOT converted: , , /// , and . /// /// The native (interop) version of this object. internal NATIVE_TABLECREATE4 GetNativeTableCreate4() { this.CheckMembersAreValid(); var native = new NATIVE_TABLECREATE4(); native.cbStruct = checked((uint)Marshal.SizeOf(typeof(NATIVE_TABLECREATE4))); native.szTableName = this.szTableName; native.szTemplateTableName = this.szTemplateTableName; native.ulPages = checked((uint)this.ulPages); native.ulDensity = checked((uint)this.ulDensity); // native.rgcolumncreate is done at pinvoke time. native.cColumns = checked((uint)this.cColumns); // native.rgindexcreate is done at pinvoke time. native.cIndexes = checked((uint)this.cIndexes); native.szCallback = this.szCallback; native.cbtyp = this.cbtyp; native.grbit = checked((uint)this.grbit); // native.pSeqSpacehints is done at pinvoke time. // native.pLVSpacehints is done at pinvoke time. native.cbSeparateLV = checked((uint)this.cbSeparateLV); native.tableid = this.tableid.Value; native.cCreated = checked((uint)this.cCreated); return native; } } }