コード例 #1
0
        //constructor
        public ServerDatabaseTableSelector()
        {
            InitializeComponent();

            if (LicenseManager.UsageMode == LicenseUsageMode.Designtime)
            {
                return;
            }

            _workerRefreshDatabases.DoWork += UpdateDatabaseListAsync;
            _workerRefreshDatabases.WorkerSupportsCancellation = true;
            _workerRefreshDatabases.RunWorkerCompleted        += UpdateDatabaseAsyncCompleted;

            _workerRefreshTables.DoWork += UpdateTablesListAsync;
            _workerRefreshTables.WorkerSupportsCancellation = true;
            _workerRefreshTables.RunWorkerCompleted        += UpdateTablesAsyncCompleted;

            var r = new RecentHistoryOfControls(cbxServer, new Guid("01ccc304-0686-4145-86a5-cc0468d40027"));

            r.AddHistoryAsItemsToComboBox(cbxServer);

            var r2 = new RecentHistoryOfControls(cbxDatabase, new Guid("e1a4e7a8-3f7a-4018-8ff5-2fd661ee06a3"));

            r2.AddHistoryAsItemsToComboBox(cbxDatabase);

            _helper = DatabaseCommandHelper.For(DatabaseType);
        }
コード例 #2
0
ファイル: SqlQueryBuilderHelper.cs プロジェクト: 24418863/rdm
        /// <summary>
        /// Returns the unique database server type <see cref="IQuerySyntaxHelper"/> by evaluating the <see cref="TableInfo"/> used in the query.
        /// <para>Throws <see cref="QueryBuildingException"/> if the tables are from mixed server types (e.g. MySql mixed with Oracle)</para>
        /// </summary>
        /// <param name="tablesUsedInQuery"></param>
        /// <returns></returns>
        public static IQuerySyntaxHelper GetSyntaxHelper(List <TableInfo> tablesUsedInQuery)
        {
            if (!tablesUsedInQuery.Any())
            {
                throw new QueryBuildingException("Could not pick an IQuerySyntaxHelper because the there were no TableInfos used in the query");
            }


            var databaseTypes = tablesUsedInQuery.Select(t => t.DatabaseType).Distinct().ToArray();

            if (databaseTypes.Length > 1)
            {
                throw new QueryBuildingException("Cannot build query because there are multiple DatabaseTypes involved in the query:" + string.Join(",",
                                                                                                                                                    tablesUsedInQuery.Select(t => t.GetRuntimeName() + "(" + t.DatabaseType + ")")));
            }

            return(DatabaseCommandHelper.For(databaseTypes.Single()).GetQuerySyntaxHelper());
        }
コード例 #3
0
 private void databaseTypeUI1_DatabaseTypeChanged(object sender, EventArgs e)
 {
     _helper = DatabaseCommandHelper.For(DatabaseType);
     UpdateDatabaseList();
 }