E
E
egorggegor2020-07-19 00:31:07
Software design
egorggegor, 2020-07-19 00:31:07

How to properly connect the database and the application?

Created a database, started writing an application for it. I am writing a connection between the application and the database. I ask to advise how it is possible to organize communication between application and a database.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
G
Gennady Kruglov, 2020-07-19
@egorggegor

What is an ORM
An example of a native ORM for your
healthy person ORM stack

B
BasiC2k, 2020-07-19
@BasiC2k

Login and password access to the database is easy to tear out of the compiled exe. This key is not even "under the rug". If the DB is on the server, consider implementing the API.

V
Vladimir Korotenko, 2020-07-19
@firedragon

EF or EF Core.
https://github.com/vkorotenko/FiasServer/blob/mast...
// direct request example

public void Truncate()
        {
            var truncate = "TRUNCATE TABLE HOUSE_HOUSENUM";
            var reset = "DBCC CHECKIDENT ('HOUSE_HOUSENUM', RESEED, 0)";
            _ctx.Database.ExecuteSqlRaw(truncate);
            _ctx.Database.ExecuteSqlRaw(reset);
        }

the context itself
https://github.com/vkorotenko/FiasServer/blob/mast...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question