本文整理汇总了C#中ConnectionType.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# ConnectionType.ToString方法的具体用法?C# ConnectionType.ToString怎么用?C# ConnectionType.ToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConnectionType
的用法示例。
在下文中一共展示了ConnectionType.ToString方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PhysicalBridge
public PhysicalBridge(ServerEndPoint serverEndPoint, ConnectionType type)
{
ServerEndPoint = serverEndPoint;
ConnectionType = type;
Multiplexer = serverEndPoint.Multiplexer;
Name = Format.ToString(serverEndPoint.EndPoint) + "/" + ConnectionType.ToString();
completionManager = new CompletionManager(Multiplexer, Name);
}
示例2: PhysicalBridge
public PhysicalBridge(ServerEndPoint serverEndPoint, ConnectionType type)
{
this.serverEndPoint = serverEndPoint;
this.connectionType = type;
this.multiplexer = serverEndPoint.Multiplexer;
this.Name = Format.ToString(serverEndPoint.EndPoint) + "/" + connectionType.ToString();
this.completionManager = new CompletionManager(multiplexer, Name);
}
示例3: BuildConnectionSource
/// <summary>Builds a ConnectionSource object give a connection type</summary>
/// <param name="ConnectionType">ConnectionType value to build a ConnectionSource for</param>
/// <returns>ConnectionSource object for the given ConnectionType</returns>
private static ConnectionSource BuildConnectionSource(ConnectionType ConnectionType)
{
ConnectionSource source = new ConnectionSource();
source.Name = ConnectionType.ToString().Replace("_", " ");
source.ConnType = ConnectionType;
switch (ConnectionType)
{
case ConnectionType.SQL_Server:
source.AuthTypes = new List<AuthType>() { AuthType.Integrated, AuthType.Basic };
source.AcceptsDatabase = false;
source.AcceptsUsername = true;
source.AcceptsPassword = true;
source.AllowBrowse = false;
break;
case ConnectionType.SQLite:
source.AuthTypes = new List<AuthType>() { AuthType.None, AuthType.Basic };
source.AcceptsDatabase = false;
source.AcceptsUsername = false;
source.AcceptsPassword = true;
source.AllowBrowse = true;
break;
case ConnectionType.DB2:
source.AuthTypes = new List<AuthType>() { AuthType.Basic };
source.AcceptsDatabase = true;
source.AcceptsUsername = true;
source.AcceptsPassword = true;
source.AllowBrowse = false;
break;
case ConnectionType.Teradata:
source.AuthTypes = new List<AuthType>() { AuthType.Basic };
source.AcceptsDatabase = false;
source.AcceptsUsername = true;
source.AcceptsPassword = true;
source.AllowBrowse = false;
break;
case ConnectionType.None:
default:
source.AuthTypes = new List<AuthType>() { AuthType.None };
source.AcceptsDatabase = false;
source.AcceptsUsername = false;
source.AcceptsPassword = false;
source.AllowBrowse = false;
break;
}
DataAccessBase db = GetConnection(ConnectionType);
source.IsAvailable = db.TestAvailability();
db.Dispose();
return source;
}
示例4: GetConnString
public static string GetConnString(ConnectionType connectionType = ConnectionType.Naviam)
{
if (ConnectionStrings[connectionType] == null)
{
string connString = null;
var connSection = ConfigurationManager.ConnectionStrings[connectionType.ToString()];
if (connSection != null)
connString = connSection.ConnectionString;
if (!String.IsNullOrEmpty(DataSource) && connString != null && connString.Contains("{0}"))
connString = String.Format(connString, DataSource);
ConnectionStrings[connectionType] = connString;
}
return ConnectionStrings[connectionType] as string;
}
示例5: Create
/// <summary>
/// Creates a StanzaStream.
/// </summary>
/// <param name="kind">Connection type, such as socket, polling, and so on.</param>
/// <param name="listener">Connection event listeners.</param>
/// <returns>StanzaStream used to connect to an XMPP server and send stanzas.</returns>
public static StanzaStream Create(ConnectionType kind, IStanzaEventListener listener)
{
switch (kind)
{
case ConnectionType.Socket:
return new SocketStanzaStream(listener);
case ConnectionType.HTTP_Polling:
return new PollingStanzaStream(listener);
case ConnectionType.HTTP_Binding:
return new BindingStanzaStream(listener);
default:
throw new NotImplementedException("Proxy type not implemented yet: " + kind.ToString());
}
}
示例6: ConnectionTypeToString
/**
* Return the string for a connection type
*/
static public string ConnectionTypeToString(ConnectionType t)
{
if( t == ConnectionType.Structured ) {
return "structured";
}
if( t == ConnectionType.Leaf ) {
return "leaf";
}
return String.Intern( t.ToString().ToLower() );
}
示例7: SetDefaultType
/// <summary>Update a user's settings to change their default connection type</summary>
/// <param name="ConnectionType">ConnectionType value to set as the default</param>
public static void SetDefaultType(ConnectionType ConnectionType)
{
Settings.Default.DefaultConnection = ConnectionType.ToString();
Settings.Default.Save();
}