A
A
Andrey Golubkov2017-10-25 19:56:13
.NET
Andrey Golubkov, 2017-10-25 19:56:13

How to execute Update-Database while application is running?

There is an application on .net core. There is an interaction with the database through the entity framework core.
After creating migrations, or before the first launch, you can write Update-Database in the NuGet Package Manager Console and it will initialize or update it.
So, such a scheme only works through the package manager console, how to make the application itself initialize (maybe there is a method in the enity framework, or in the database context class)?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Kovalsky, 2017-10-26
@Android97

In my opinion: to carry out such masturbation within the logic of the application is a below average idea.
But what if for some reason the update does not roll? Repeat? roll back to a stable version of some kind? And if the application logic is tied to the fact that the database will be updated 100% - I don’t know what to do at all. If you need to automate the process, I would look towards continuous integration solutions if I were you. Still, updating the contours is one thing, and the operation of the application is a slightly different process.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question