Closed LiamKenneth closed 5 years ago
It seems I needed to add { get; set; }
to all the properties. Any idea why? As the code worked without them before I was using LiteDB.
Hi, when you define: public bool Trainer;
it's not a property, it's a field. Fields not serialize by default. You can define mapper to serialize fields, using:
BsonMapper.Global.IncludeFields = true;
Ah I see. Thanks. Iv'e learnt something new today 👍 :)
Hi, I'm changing my Project to use LiteDB instead of Mongo and have this code to save player data:
This saves some data but not all:
It should be inserting all the properties from my Player class. Wondering if you know why most of them are being skipped.
Player properties:
I assign values to the properties in the constructor
Sorry for the long list but you can see above how many properties are not being saved into the DB. Nothing is standing out to me as a reason why it would not save all the data. Also no errors are thrown stepping through the code.
Thanks for any help you can give!