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


C# DatabaseType类代码示例

本文整理汇总了C#中DatabaseType的典型用法代码示例。如果您正苦于以下问题:C# DatabaseType类的具体用法?C# DatabaseType怎么用?C# DatabaseType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


DatabaseType类属于命名空间,在下文中一共展示了DatabaseType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CheckIfAuditTableExists

        private static void CheckIfAuditTableExists(Type auditRecordType, DatabaseType  databaseType)
        {
            var classConfig = ClassConfigContainer.FindClassConfig(auditRecordType);

            var table = classConfig.TableName;

            var sql = string.Empty;

            if (databaseType != DatabaseType.Oracle)
            {
                sql = string.Format("SELECT COUNT(*) " +
                                    "FROM INFORMATION_SCHEMA.TABLES " +
                                    "WHERE TABLE_SCHEMA = '[Schema]'   AND  TABLE_NAME = '{0}'  OR   TABLE_NAME = '{1}' ",
                                    table.ToLower(), table);

            }
            else
            {
                sql = string.Format("SELECT COUNT(*) FROM  ALL_TABLES  WHERE OWNER ='[Schema]'  AND TABLE_NAME ='{0}'",
                                    table);
            }
         
        
            var database = DatabaseCreator.CreateDatabase();

            var result = database.ExecuteScalar(sql);

            if (result.ToString() == "0")
            {
                throw new EasylinkException("Audit table {0} does not exist in the database.", table);
            }

        }
开发者ID:EasyExpress,项目名称:Easylink,代码行数:33,代码来源:DatabaseSetup.cs

示例2: AddCeDatabase

 private void AddCeDatabase(DatabaseType dbType)
 {
     try
     {
         var dialog = new ConnectionDialog();
         string path;
         if (TryGetInitialPath(package, out path))
         {
             dialog.InitialPath = path;                
         }
         dialog.DbType = dbType;
         dialog.ShowDDEXInfo = package.VSSupportsSimpleDDEX4Provider() || package.VSSupportsSimpleDDEX35Provider();
         dialog.CouldSupportPrivateProvider =
             (dbType == DatabaseType.SQLCE40 && (SqlCeToolboxPackage.VisualStudioVersion == new Version(12, 0) || SqlCeToolboxPackage.VisualStudioVersion == new Version(14, 0)) )
             || (dbType == DatabaseType.SQLCE35 && package.VSSupportsEF6());
         bool? result = dialog.ShowModal();
         if (result.HasValue && result.Value == true)
         {
             if (!string.IsNullOrWhiteSpace(dialog.ConnectionString))
             {
                 Helpers.DataConnectionHelper.SaveDataConnection(dialog.ConnectionString, dbType, package);
                 ExplorerControl control = _parentWindow.Content as ExplorerControl;
                 control.BuildDatabaseTree();
                 Helpers.DataConnectionHelper.LogUsage("DatabasesAddCeDatabase");
             }
         }
     }
     catch (Exception ex)
     {
         Helpers.DataConnectionHelper.SendError(ex, dbType);
     }
 }
开发者ID:inickvel,项目名称:SqlCeToolbox,代码行数:32,代码来源:DatabasesMenuCommandsHandler.cs

示例3: UpgradeDatabase

        public static void UpgradeDatabase(DbConnection connection, DatabaseType databaseType)
        {
            // Figure out the current version of the schema
            int currentVersion;
            using (DbCommand cmd = connection.CreateCommand())
            {
                cmd.CommandText = "SELECT val FROM setup WHERE `key`='schemaVersion';";
                using (DbDataReader reader = cmd.ExecuteReader())
                {
                    if (!reader.Read())
                        currentVersion = 1;
                    else
                        currentVersion = int.Parse(reader.GetString(reader.GetOrdinal("val")));
                }
            }

            // Now get the set of migrations we have avaiable
            List<int> migrationVersions = GetMigrationVersions(databaseType);
            foreach (int migration in migrationVersions)
            {
                if (currentVersion < migration)
                {
                    PerformMigration(connection, databaseType, migration);
                }
            }
        }
开发者ID:wdjc100,项目名称:CamLog,代码行数:26,代码来源:DbMigrator.cs

示例4: EntityAttribue

 public EntityAttribue(string _TableName, string _ConectionName, DatabaseType _DbType, bool _EnableCache)
 {
     this.TableName = _TableName;
     this.ConectionName = _ConectionName;
     this.DbType = _DbType;
     this.EnableCache = _EnableCache;
 }
开发者ID:huyihuan,项目名称:BlueSky,代码行数:7,代码来源:EntityAttribue.cs

示例5: DirectionBinaryObject

 public DirectionBinaryObject(XDirection direction, DatabaseType databaseType)
 {
     DatabaseType = databaseType;
     ObjectType = ObjectType.Direction;
     Direction = direction;
     Build();
 }
开发者ID:hjlfmy,项目名称:Rubezh,代码行数:7,代码来源:DirectionBinaryObject.cs

示例6: AddPutBit

 public void AddPutBit(XStateType stateType, XBinaryBase binaryBase, DatabaseType databaseType)
 {
     Add(FormulaOperationType.PUTBIT,
         (byte)stateType,
         binaryBase.GetDatabaseNo(databaseType),
         "Запись состояния " + stateType.ToDescription() + " " + XBinaryBaseToString(binaryBase));
 }
开发者ID:hjlfmy,项目名称:Rubezh,代码行数:7,代码来源:FormulaBuilder.cs

示例7: ZoneBinaryObject

 public ZoneBinaryObject(XZone zone, DatabaseType databaseType)
 {
     DatabaseType = databaseType;
     ObjectType = ObjectType.Zone;
     Zone = zone;
     Build();
 }
开发者ID:hjlfmy,项目名称:Rubezh,代码行数:7,代码来源:ZoneBinaryObject.cs

示例8: ConnectionInformation

 public ConnectionInformation(string tableName, string connKey, string[] pirmaryKeys,DatabaseType dbType)
 {
     this.TableName = tableName;
     this.ConnectionKey = connKey;
     this.PrimaryKeys = pirmaryKeys;
     this.DbType = dbType;
 }
开发者ID:TaylorLi,项目名称:gettogether,代码行数:7,代码来源:ConnectionInformation.cs

示例9: DataTableUNION

        public static DataTable DataTableUNION(DatabaseType dbT, string cs, params string[] fieldTableUNION)
        {
            string req = "";
            for (int i = 0; i < fieldTableUNION.Length - 2; i += 2)
            {
                req += "SELECT DISTINCT " + fieldTableUNION[i] + " FROM " + fieldTableUNION[i + 1] + " UNION ";
            }
            req += "SELECT DISTINCT " + fieldTableUNION[fieldTableUNION.Length - 2] + " FROM " + fieldTableUNION[fieldTableUNION.Length - 1];

            DataTable t = new DataTable();

            switch (dbT)
            {
                case DatabaseType.OleDb:
                    using (OleDbConnection c = Connection(dbT, cs) as OleDbConnection)
                    {
                        using (OleDbDataAdapter a = new OleDbDataAdapter(req, c))
                        {
                            a.Fill(t);
                        }
                    }
                    break;
                default:
                    break;
            }
            return t;
        }
开发者ID:jalil1408,项目名称:LOGEMENT,代码行数:27,代码来源:UtlDb.cs

示例10: DataTypeInstanceAttribute

 public DataTypeInstanceAttribute(string propertyEditorAlias = null, string name = null, Type converterType = null, DatabaseType dbType = DatabaseType.None)
 {
     Name = name;
     PropertyEditorAlias = propertyEditorAlias;
     ConverterType = converterType;
     DbType = dbType;
 }
开发者ID:DanMannMann,项目名称:UmbracoCodeFirst,代码行数:7,代码来源:DataTypeInstanceAttribute.cs

示例11: Create

        public static DbTypeProvider Create(DatabaseType databaseType)
        {
            if (databaseType == DatabaseType.Postgres)
                return new PostgresDbTypeProvider();

            return null;
        }
开发者ID:koksaver,项目名称:CodeHelper,代码行数:7,代码来源:DbTypeProvider.cs

示例12: CreateCommand

        public static IDbCommand CreateCommand(string CommandText, DatabaseType dbtype,
            IDbConnection cnn)
        {
            IDbCommand cmd;
            switch (dbtype)
            {
                case DatabaseType.Access:
                    cmd = new OleDbCommand
                       (CommandText,
                       (OleDbConnection)cnn);
                    break;

                case DatabaseType.SQLServer:
                    cmd = new SqlCommand
                       (CommandText,
                       (SqlConnection)cnn);
                    break;

                default:
                    cmd = new SqlCommand
                       (CommandText,
                       (SqlConnection)cnn);
                    break;
            }

            return cmd;
        }
开发者ID:Walliee,项目名称:PicBook,代码行数:27,代码来源:DAL.cs

示例13: Create

        /// <summary>
        /// 获取数据库帮助对象。
        /// </summary>
        /// <param name="database">数据库类型</param>
        /// <param name="host">数据库主机</param>
        /// <param name="instance">数据库实例</param>
        /// <param name="account">账号</param>
        /// <param name="password">密码</param>
        /// <param name="port">端口号</param>
        /// <returns>数据库帮助对象</returns>
        public static DbHelper Create(
            DatabaseType database,
            string host,
            string instance,
            string account,
            string password,
            int? port = null)
        {
            var connectionString = GetConnectionString(database, host, instance, account, password, port);
            var dbHelper = new DbHelper(Providers[(int)database], connectionString);

            switch (database)
            {
                case DatabaseType.MSSQL:
                    dbHelper.DbMetadata = new MSSQLMetadata();

                    break;
                case DatabaseType.Oracle:
                    dbHelper.DbMetadata = new OracleMetadata();

                    break;
            }

            return dbHelper;
        }
开发者ID:fenglinz,项目名称:Sparrow,代码行数:35,代码来源:DbHelperCreator.cs

示例14: DatabaseQueryTransformRule

 public DatabaseQueryTransformRule(string connectionString, DatabaseType dbType, string query, DicomTag[] outputTags, DicomTag[] paramTags) {
     _connectionString = connectionString;
     _dbType = dbType;
     _query = query;
     _output = new List<DicomTag>(outputTags);
     _params = new List<DicomTag>(paramTags);
 }
开发者ID:ZeryZhang,项目名称:fo-dicom,代码行数:7,代码来源:DatabaseQueryTransformRule.cs

示例15: DataTable

 public static DataTable DataTable(DatabaseType dbT, string cs, string req, params object[] paramaters)
 {
     DataTable t = new DataTable();
     switch (dbT)
     {
         case DatabaseType.OleDb:
             using (OleDbConnection c = Connection(dbT, cs) as OleDbConnection)
             {
                 using (OleDbDataAdapter a = new OleDbDataAdapter(req, c))
                 {
                     for (int i = 0; i < paramaters.Length; i += 2)
                     {
                         if (req.Contains("@" + paramaters[i] as string))
                         {
                             a.SelectCommand.Parameters.AddWithValue("@" + paramaters[i] as string, paramaters[i + 1]);
                         }
                     }
                     a.Fill(t);
                 }
             }
             break;
         default:
             break;
     }
     return t;
 }
开发者ID:jalil1408,项目名称:LOGEMENT,代码行数:26,代码来源:UtlDb.cs


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