forked from ClearMeasure/AliaSQL
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConnectionSettings.cs
More file actions
66 lines (56 loc) · 1.58 KB
/
Copy pathConnectionSettings.cs
File metadata and controls
66 lines (56 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
namespace AliaSQL.Core.Model
{
public class ConnectionSettings
{
private string _database;
private bool _integratedAuthentication;
private string _password;
private string _server;
private string _username;
public ConnectionSettings(string server, string database, bool integratedAuthentication, string username,
string password)
{
_server = server;
_database = database;
_integratedAuthentication = integratedAuthentication;
_username = username;
_password = password;
}
public string Database
{
get { return _database; }
}
public bool IntegratedAuthentication
{
get { return _integratedAuthentication; }
}
public string Password
{
get { return _password; }
}
public string Server
{
get { return _server; }
}
public string Username
{
get { return _username; }
}
public override bool Equals(object obj)
{
ConnectionSettings settings = (ConnectionSettings)obj;
bool serverMatches = Server == settings.Server;
bool databaseMatches = Database == settings.Database;
bool integratedMatches = IntegratedAuthentication == settings.IntegratedAuthentication;
bool usernameMatches = Username == settings.Username;
bool passwordMatches = Password == settings.Password;
return (serverMatches && databaseMatches && integratedMatches && usernameMatches && passwordMatches);
}
public override int GetHashCode()
{
string combinedKey = _server + _database + _username + _password + _integratedAuthentication;
int hashCode = combinedKey.GetHashCode();
return hashCode;
}
}
}