B
B
bullock2018-01-22 16:18:41
.NET
bullock, 2018-01-22 16:18:41

EntityFramework and SaveChanges() method, is it slow?

In one of my pedprojects on .Net Core, I implemented logging in Sqlite by connecting the Microsoft.EntityFrameworkCore.Sqlite module.
In order for the record to be saved to the database, you need to call it SaveChanges()every time. But I suspect it's costly to do this for every record.
Question: where is it correct to call this method? Can you do it on a timer? Or accumulate somewhere in memory and then call?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
Bogdan, 2018-01-22
@bullock

If you do not write logs every time, but accumulate them, then there is a chance that before saving a bunch of logs you will have an application and then you will no longer read any logs.
In general, writing logs through EF is like heating a stove with paper, instead of firewood / coal.
If you want structured logs, I highly recommend taking a look at MongoDB.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question