public ConnectionHandle() : base(true) { SetHandle(Interop.Ldap.ldap_init(null, 389)); if (handle == IntPtr.Zero) { int error = Interop.Ldap.LdapGetLastError(); if (LdapErrorMappings.IsLdapError(error)) { string errorMessage = LdapErrorMappings.MapResultCode(error); throw new LdapException(error, errorMessage); } else { throw new LdapException(error); } } }
internal ConnectionHandle(IntPtr value, bool disposeHandle) : base(true) { _needDispose = disposeHandle; if (value == IntPtr.Zero) { int error = Interop.Ldap.LdapGetLastError(); if (LdapErrorMappings.IsLdapError(error)) { string errorMessage = LdapErrorMappings.MapResultCode(error); throw new LdapException(error, errorMessage); } else { throw new LdapException(error); } } else { SetHandle(value); } }