/// <summary> /// Gets the NATIVE_CONDITIONALCOLUMN version of this object. /// </summary> /// <returns>A NATIVE_CONDITIONALCOLUMN for this object.</returns> internal NATIVE_CONDITIONALCOLUMN GetNativeConditionalColumn() { var native = new NATIVE_CONDITIONALCOLUMN(); native.cbStruct = (uint) Marshal.SizeOf(native); native.szColumnName = this.szColumnName; native.grbit = (uint) this.grbit; return native; }
/// <summary> /// Gets the NATIVE_CONDITIONALCOLUMN version of this object. /// </summary> /// <returns>A NATIVE_CONDITIONALCOLUMN for this object.</returns> internal NATIVE_CONDITIONALCOLUMN GetNativeConditionalColumn() { var native = new NATIVE_CONDITIONALCOLUMN(); native.cbStruct = (uint)Marshal.SizeOf(typeof(NATIVE_CONDITIONALCOLUMN)); native.grbit = (uint)this.grbit; return(native); }
public void Setup() { this.managed = new JET_CONDITIONALCOLUMN { szColumnName = "column", grbit = ConditionalColumnGrbit.ColumnMustBeNonNull, }; this.native = this.managed.GetNativeConditionalColumn(); }
/// <summary> /// Sets all of the fields (not just output fields) of the object from a <see cref="NATIVE_INDEXCREATE3"/> struct, /// specifically <see cref="err"/>. /// </summary> /// <param name="value"> /// The native indexcreate to set the values from. /// </param> internal void SetAllFromNativeIndexCreate(ref NATIVE_INDEXCREATE3 value) { this.szIndexName = Marshal.PtrToStringUni(value.szIndexName); this.cbKey = unchecked ((int)value.cbKey / sizeof(char)); this.szKey = Marshal.PtrToStringUni(value.szKey, this.cbKey); if (this.cbKey != this.szKey.Length) { throw new ArgumentException(string.Format("cbKey {0} != szKey.Length {1}", this.cbKey, this.szKey.Length)); } this.grbit = unchecked ((CreateIndexGrbit)value.grbit); this.ulDensity = unchecked ((int)value.ulDensity); unsafe { this.pidxUnicode = new JET_UNICODEINDEX(ref *value.pidxUnicode); } this.cbVarSegMac = (int)value.cbVarSegMac; this.cConditionalColumn = unchecked ((int)value.cConditionalColumn); this.rgconditionalcolumn = new JET_CONDITIONALCOLUMN[this.cConditionalColumn]; int sizeofConditionalColumn = Marshal.SizeOf(typeof(NATIVE_CONDITIONALCOLUMN)); for (int i = 0; i < this.cConditionalColumn; ++i) { IntPtr addressOfElement = value.rgconditionalcolumn + i * sizeofConditionalColumn; NATIVE_CONDITIONALCOLUMN nativeConditionalColumn = (NATIVE_CONDITIONALCOLUMN)Marshal.PtrToStructure(addressOfElement, typeof(NATIVE_CONDITIONALCOLUMN)); this.rgconditionalcolumn[i] = new JET_CONDITIONALCOLUMN(ref nativeConditionalColumn); } this.err = (JET_err)value.err; this.cbKeyMost = unchecked ((int)value.cbKeyMost); var nativeSpaceHints = (NATIVE_SPACEHINTS)Marshal.PtrToStructure(value.pSpaceHints, typeof(NATIVE_SPACEHINTS)); this.pSpaceHints = new JET_SPACEHINTS(); this.pSpaceHints.SetFromNativeSpaceHints(nativeSpaceHints); }
/// <summary> /// Initializes a new instance of the <see cref="JET_CONDITIONALCOLUMN"/> class. /// </summary> /// <param name="native">The native object from which to read values.</param> internal JET_CONDITIONALCOLUMN(ref NATIVE_CONDITIONALCOLUMN native) { this.szColumnName = Marshal.PtrToStringUni(native.szColumnName); this.grbit = (ConditionalColumnGrbit)native.grbit; }