[QUESTION] Best practices in Xamarin.Forms
Hey guys. I would be grateful if someone can provide a small guide how to use LiteDB v 5 in Xamarin.Forms - because with the implementation i have now - i see that my db is not being disposed and the log file grows. Should i always call db.Dispose in my code as you always advice? Or wrap up my DBService's methods in using? But then i was getting "object has been disposed" errors. I suppose there is an elegant way how to instantiate a db and use it normally, but i can't figure it out. All articles out there on the web are about v 4, so it would be cool to know how to add LiteDB v 5 to a Xamarin app correctly. I can share my current implementation. Thanks in advance!
@themronion First of all, check the db.CheckpointSize property in your LiteDatabase objects, if it's 0 it means the auto-checkpoint is disabled (default value is 1000).
The recommended way to use LiteDB is to keep the datafile open throughout the lifetime of your application and to call db.Dispose() at the end (possibly with a using block), but we realize it is not always possible to construct you app this way. If log file growth is a problem, try calling db.Checkpoint() manually once in a while.