Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reading/Writing empty String #1011

Closed
wilberolive opened this issue Jun 23, 2018 · 1 comment
Closed

Reading/Writing empty String #1011

wilberolive opened this issue Jun 23, 2018 · 1 comment

Comments

@wilberolive
Copy link

I have a class that has a String variable in it. Some instances of the class have the String set to something, but other instances just have it set to an empty string (i.e. "").

When I write the list of instances of this class to a LiteDB, I'm finding that the ones with an empty string are being written as [NULL]. So when I read them back from the database, these instances have Nothing in their String variable instead of "". This then causes a problem in my application which is not expecting the String variable to have a value of Nothing.

I know I could just check for Nothing, but I'm looking for a better solution that to have to check for Nothing every single time. Is there a way to either have LiteDB read an empty string instead of Nothing or is there a way I can inject and empty string inplace of Nothing when the class instances are loaded?

@Szymaniuk
Copy link

Szymaniuk commented Jun 23, 2018

Set EmptyStringToNull to false - more details here https://github.com/mbdavid/LiteDB/wiki/Object-Mapping

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants