Answer the question
In order to leave comments, you need to log in
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
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 questionAsk a Question
731 491 924 answers to any question