Litedb: EmptyString will be convert to null

Created on 6 Jul 2017  路  4Comments  路  Source: mbdavid/LiteDB

POCO:

public class Poco{
    public string phone {get;set;} //set to key with mapper
    public string str {get;set;}
}

save an entity which str property value was string.Empty, read it after, str is null

version : 3.1

Most helpful comment

Set BsonMapper.Global.EmptyStringToNull to false.

All 4 comments

Set BsonMapper.Global.EmptyStringToNull to false.

How is that not the default?

How is that not the default?

I agree with you.

After studying on this, It seems that it was a default setting of MongoDb, as a follower to MongoDb, LiteDb continues the same default setting is quite reasonable.

Was this page helpful?
0 / 5 - 0 ratings