2using System.Collections.Generic;
5using System.Threading.Tasks;
52 public ConnectInfo(
string strServer =
null,
string strDb =
"DNN",
string strUn =
null,
string strPw =
null,
TYPE location =
TYPE.NONE)
54 m_strServer = strServer;
58 m_location = location;
68 if (ci.
Server != m_strServer)
92 if (m_strServer ==
null)
95 if (m_strServer ==
"AZURE")
98 return m_strServer +
"\\" + m_strDb;
108 if (m_strServer.Contains(strAzure))
119 get {
return m_location; }
120 set { m_location = value; }
128 get {
return m_strServer; }
129 set { m_strServer = value; }
137 get {
return m_strDb; }
138 set { m_strDb = value; }
146 get {
return m_strUn; }
154 get {
return m_strPw; }
177 str +=
"Type\t" +
Location.ToString() +
";";
178 str +=
"Server\t" +
Server +
";";
179 str +=
"Database\t" +
Database +
";";
180 str +=
"Username\t" +
Username +
";";
181 str +=
"Password\t" +
Password +
";";
193 string[] rgstr = strKeyValPairs.Split(
';');
194 string strServer =
null;
195 string strDatabase =
null;
196 string strUsername =
null;
197 string strPassword =
null;
198 string strType =
null;
201 foreach (
string str1
in rgstr)
203 if (!
string.IsNullOrEmpty(str1))
205 string[] rgstr1 = str1.Split(
'\t');
206 if (rgstr1.Length != 2)
207 throw new Exception(
"ConnectInfo: Invalid key-value pair!");
209 if (rgstr1[0] ==
"Type")
212 else if (rgstr1[0] ==
"Server")
213 strServer = rgstr1[1];
215 else if (rgstr1[0] ==
"Database")
216 strDatabase = rgstr1[1];
218 else if (rgstr1[0] ==
"Username")
219 strUsername = rgstr1[1];
221 else if (rgstr1[0] ==
"Password")
222 strPassword = rgstr1[1];
226 if (strType ==
TYPE.AZURE.ToString())
227 location =
TYPE.AZURE;
228 else if (strType ==
TYPE.REMOTE.ToString())
229 location =
TYPE.REMOTE;
230 else if (strType ==
TYPE.LOCAL.ToString())
231 location =
TYPE.LOCAL;
233 if (strServer.Length == 0)
236 if (strDatabase.Length == 0)
239 if (strUsername.Length == 0)
242 if (strPassword.Length == 0)
245 return new ConnectInfo(strServer, strDatabase, strUsername, strPassword, location);
The ConnectInfo class specifies the server, database and username/password used to connect to a datab...
ConnectInfo(string strServer=null, string strDb="DNN", string strUn=null, string strPw=null, TYPE location=TYPE.NONE)
The constructor.
string ToInfoString()
Returns a string representation of the connection information.
string Server
Get/set the server.
string Username
Returns the username.
TYPE
Defines the generic connection location
override string ToString()
Returns a string representation of the connection.
string Database
Get/set the database.
bool Compare(ConnectInfo ci)
Compare another ConnectInfo with this one.
string Password
Returns the password.
TYPE Location
Get/set the generic location type.
string ToString(string strAzure)
Returns a string representation of the connection.
string ToKeyValuePairs()
Returns the connection information as a set of key-value pairs.
static ConnectInfo ParseKeyValuePairs(string strKeyValPairs)
Parses a key-value pair string containing the connection information and returns a ConnectInfo.
The MyCaffe.basecode contains all generic types used throughout MyCaffe.
@ NONE
No training category specified.