本文整理汇总了C#中DataBaseType.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# DataBaseType.ToString方法的具体用法?C# DataBaseType.ToString怎么用?C# DataBaseType.ToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataBaseType
的用法示例。
在下文中一共展示了DataBaseType.ToString方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Dao
/*
public Dao()
{
try
{
connectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
switch (ConfigurationManager.ConnectionStrings["ConnectionString"].ProviderName.ToUpper())
{
case "SQLSERVER":
DataBaseType = DataBaseType.SqlServer;
break;
case "FIREBIRD":
DataBaseType = DataBaseType.Firebird;
break;
case "MYSQL":
DataBaseType = DataBaseType.MySql;
break;
default:
throw new Exception("O banco de dados " + ConfigurationManager.ConnectionStrings["ConnectionString"].ProviderName.ToUpper() + " não é suportado por esta biblioteca. Deve-se usar um dos seguintes bancos: SQLSERVER,FIREBIRD ou MYSQL.");
}
BootConnection();
}
catch (Exception ex)
{
throw new Exception("Erro no construtor Connection().", ex);
}
}
*/
public Dao(DataBaseType dataBaseType, string connectionString)
{
try
{
this.connectionString = connectionString;
this.dataBaseType = dataBaseType;
BootConnection();
}
catch (Exception ex)
{
throw new Exception("Erro no construtor Connection(" + connectionString + "," + dataBaseType.ToString() + "). \n" + ex.Message, ex);
}
}
示例2: ExportAsRuntimeDatabaseAttribute
/// <summary>
/// Initializes a new instance of the <see cref="ExportAsRuntimeDatabaseAttribute"/> class.
/// </summary>
/// <param name="databaseType">The database type.</param>
public ExportAsRuntimeDatabaseAttribute(DataBaseType databaseType)
: base(ExportedContractName, typeof(IRuntimeDatabase))
{
DatabaseType = databaseType.ToString();
}
示例3: CreateDatabase
public static DataBase CreateDatabase(DataBaseType nType, string nConnectionString)
{
string remotingString = GetRemotingUrl(nConnectionString);
if (remotingString != "")
{
try
{
string remotingPassword = GetRemotingPassword(nConnectionString);
bool remotingTrusted = GetRemotingTrusted(nConnectionString);
//Inicializar remoting
TcpChannel CanalTCP = ChannelServices.GetChannel("tcp") as TcpChannel;
if (CanalTCP != null)
{
if (CanalTCP.IsSecured != remotingTrusted)
{
try { ChannelServices.UnregisterChannel(CanalTCP); }
catch { }
RegisterChannel(remotingTrusted);
}
}
else
{
RegisterChannel(remotingTrusted);
}
// "tcp://localhost:8085/nAppName"
var instance = (DataBaseProxy)Activator.GetObject(typeof(DataBaseProxy), remotingString);
var ServerPublicKey = instance.getServerPublicKey();
var remotingEncriptedPassword = Crypto.RSAEncryptText(remotingPassword, ServerPublicKey);
DataBase db;
string Message;
if (!instance.CreateDataBase(nType, nConnectionString, remotingEncriptedPassword, out db, out Message))
{
throw new Exception(Message);
}
return db;
}
catch (Exception ex)
{
throw new Exception("No fue posible conectarse con el servidor remoto, " + ex.Message, ex);
}
}
else
{
try
{
switch (nType)
{
case DataBaseType.Postgres:
return new PostgresDataBase(GetInnerConnectionString(nConnectionString));
case DataBaseType.SqlServer:
return new SqlServerDataBase(GetInnerConnectionString(nConnectionString));
case DataBaseType.Oracle:
return new OracleDataBase(GetInnerConnectionString(nConnectionString));
default:
throw new Exception("Dase de datos no permitida " + nType.ToString());
}
}
catch (Exception ex)
{
throw new Exception("No fue posible inicializar el control de base de datos, " + ex.Message, ex);
}
}
}
示例4: ExportAsPersonManagerAttribute
/// <summary>
/// Initializes a new instance of the <see cref="ExportAsPersonManagerAttribute"/> class.
/// </summary>
/// <param name="databaseType">
/// The database type.
/// </param>
public ExportAsPersonManagerAttribute(DataBaseType databaseType)
: base(ExportedContractName, typeof(IPersonManager))
{
_databaseType = databaseType.ToString();
}