Is there an attribute for private properties to be stored with the LiteDB engine?
I want to store this property in the LiteDB database
private string SomeGoodPropertyName { get; set; }
Is there an exact opposite of the [BsonIgnore]
attribute, (like "[BsonInclude]
") which includes private fields in the storage process?
I tried to simply set the [BsonField]
attribute, but that did not help, and I looked at Mappers, but as far as I saw all of them rely on the field being public.
Here is an example of why I would want to do that: I have the following class:
public class Authenticator {
private string AuthenticationString { get; set; }
private CashRegisterType ActiveCashRegisterType { get; set; }
public void SetAuthenticationString(string authString, CashRegisterType type)
{
//Perform some validation
...
AuthenticationString = authString;
ActiveCashRegisterType = type;
}
public string GetAuthenticatorString(CashRegisterType type){
//Validate request -> returns null if validation failed
...
return AuthenticationString;
}
}
This object should now be stored in the database (as a child object of another document). I do not want the two properties to be public, because I have to perform the validation before setting and getting it, but I want to store the data on the disk.