D
D
Duskone392019-07-27 18:53:43
.NET
Duskone39, 2019-07-27 18:53:43

Do I need to create model objects (Entity Framework) from the database when the application starts?

The essence of what is happening is as follows. There is a C# Entity Framework Code First application, there is a data model. If I run the application and create objects, then they are in RAM and EF fills the database. Suddenly (accidentally / on purpose) the application closes and when it opens again, the application will not know about these objects, but they will be in the database.
Attention connoisseurs ... a question! How should the application be built? When loading, you need to go through your database and recreate all the objects from it in RAM, or the entire application logic must work with queries to the database, and the objects themselves exist only while EF adds them to the database.
Clarification, yes I am the bottom, but it is very necessary to organize work with the database)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
#
#, 2019-07-27
@Duskone39

all application logic must work with database queries
everything before and after is imagination. practice and everything will become clear

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question