当前位置: 首页>>代码示例>>C#>>正文


C# DataBaseType.ToString方法代码示例

本文整理汇总了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);
     }
 }
开发者ID:AndersonGoncalves,项目名称:Build.Siac,代码行数:41,代码来源:Dao.cs

示例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();
 }
开发者ID:mparsin,项目名称:Elements,代码行数:9,代码来源:ExportAsRuntimeDatabaseAttribute.cs

示例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);
                }
            }
        }
开发者ID:jcrajat,项目名称:DAL_Design,代码行数:73,代码来源:DataBaseFactory.cs

示例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();
 }
开发者ID:mparsin,项目名称:Elements,代码行数:11,代码来源:ExportAsPersonManagerAttribute.cs


注:本文中的DataBaseType.ToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。