C # OO Design Question

I have a Windows application written in C #. the main_form class creates an AccessProcess instance called AccessProcessWorker, which is a class that inherits from BackgroundWorker, then main_form then initializes the Process with the following code

        AccessProcessWorker.DoWork += new DoWorkEventHandler(processWorker.worker_DoWork);
        AccessProcessWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(processWorkerCompleted);
        AccessProcessWorker.ProgressChanged += new ProgressChangedEventHandler(processProgressChanged);

this application has just left POC to "get it working fast."

I wrote this application for working with Access database, but now I want this to happen against MS Sql, but also leave the opportunity to work with access. That way, I could do something ugly, like instantiate and initialize SqlProcessWorker or AccessProcessWorker based on some user interface choice made by the user. But I would like to make main_form always create something like IProcess, so I didn’t have to add logic to main_form every time a new ProcessWorker appears. The problem in my design is that initialization breaks when I do it the way I described.

If anyone has any ideas or needs further clairification, please let me know.

+3
6

, , " ".

+4

, "" .

Access SQL Server , , ? .

, , , . KISS.

+2

, EntitySpaces , , , , Access SQL.

+1

"" , , , , , , BackgroundWorker. DRY: .

+1

, , , , , .

, , -, , Sql Server, MS Access? , OleDbConnection, OleDbCommand? SQL , , , .

, , , . , plumbery. , ( , ).

0
source

Source: https://habr.com/ru/post/1708059/


All Articles