A
A
ALTech12021-04-24 12:57:06
MongoDB
ALTech1, 2021-04-24 12:57:06

How to get rid of long loading MongoDB?

Hello!
I am making a small messenger and using MongoDB as a database. But connecting to the database wildly slows down the launch of the application. Is it possible to fix this somehow. Tried to make an asynchronous method, but it didn't work.
The constructor of the class in which I connect to the database.

public DataBase()
        {
            var client = new MongoClient(connectionString);
            database = client.GetDatabase("Sliderer");
        }

Application launch function, where I initialize the class.
private DataBase data;

        public MainWindow()
        {
            InitializeComponent();
            data = new DataBase();
        }

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vasily Bannikov, 2021-04-24
@ALTech1

Well, asynchrony will not help here, because apparently the designers themselves slow down.
All I can advise is to build in Release and ReadyToRun.
You can also try to initialize the database after showing the windows, and until the connection is established, show the spinner.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question