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

Null String in Database returns String.Empty instead of Null when mapping into anonymous class #333

Open
Atri15 opened this issue Nov 25, 2014 · 0 comments

Comments

@Atri15
Copy link

Atri15 commented Nov 25, 2014

The issue is similar as #321

I've set the config value to null
BLToolkit.Common.Configuration.NullableValues.String = null;
but it does not work for select to the anonymous class.

public partial class Table1{
...
[MapField("string_value"), Nullable]
public string    StringValue        { get; set; } // nvarchar(-1)
...
}

var query =
        d.GetTable<Table1>()
               .Where(x => x.StringValue == null)
               .Select(x => new { x, x.StringValue });

var queryData = query.First();

And result in json is:

queryData = 
{
  "x": {
 ...
    "StringValue": null,
...
  },
  "StringValue": ""
}

But expected:

queryData = 
{
  "x": {
 ...
    "StringValue": null,
...
  },
  "StringValue": null
}
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

1 participant