public override bool Equals(object obj) { var settings = obj as LdapSettings; return(settings != null && EnableLdapAuthentication == settings.EnableLdapAuthentication && StartTls == settings.StartTls && Ssl == settings.Ssl && (string.IsNullOrEmpty(Server) && string.IsNullOrEmpty(settings.Server) || Server == settings.Server) && (string.IsNullOrEmpty(UserDN) && string.IsNullOrEmpty(settings.UserDN) || UserDN == settings.UserDN) && PortNumber == settings.PortNumber && UserFilter == settings.UserFilter && LoginAttribute == settings.LoginAttribute && LdapMapping.Count == settings.LdapMapping.Count && LdapMapping.All(pair => settings.LdapMapping.ContainsKey(pair.Key) && pair.Value == settings.LdapMapping[pair.Key]) && AccessRights.Count == settings.AccessRights.Count && AccessRights.All(pair => settings.AccessRights.ContainsKey(pair.Key) && pair.Value == settings.AccessRights[pair.Key]) && GroupMembership == settings.GroupMembership && (string.IsNullOrEmpty(GroupDN) && string.IsNullOrEmpty(settings.GroupDN) || GroupDN == settings.GroupDN) && GroupFilter == settings.GroupFilter && UserAttribute == settings.UserAttribute && GroupAttribute == settings.GroupAttribute && (string.IsNullOrEmpty(Login) && string.IsNullOrEmpty(settings.Login) || Login == settings.Login) && Authentication == settings.Authentication); }