You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a table MyEvent which contains a JsonB "Description" column which is an object containing 2 strings:
public class MyEvent
{
[Key]
public int Id { get; set; }
[Column(TypeName = "jsonb")]
public Translations Description { get; set; } = null!;
}
public class Translations
{
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public string? En { get; set; }
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public string? De { get; set; }
}
Data is definitely there as I can select it and it's Length is 756.
var result = await _dbContext.MyEvents
.Where(e =>e.Id == eventId)
.Select(e => e.Description.En)
.SingleAsync();
But if I'm trying to select the Length then it throws the System.InvalidOperationException: 'Nullable object must have a value.'
var result = await _dbContext.MyEvents
.Where(e =>e.Id == eventId)
.Select(e => e.Description.En.Length)
.SingleAsync();
Trying to use it as a where filter returns false even though it should be true.
var result = await _dbContext.MyEvents
.Where(e =>e.Id == eventId && e.Description.En.Length)
.SingleAsync();
Is Length not yet supported and I have to load the data to evaluate it's length?
I've checked the docs and couldn't find anything useful
The text was updated successfully, but these errors were encountered:
EF Core 8.0.7
I have a table MyEvent which contains a JsonB "Description" column which is an object containing 2 strings:
Data is definitely there as I can select it and it's Length is 756.
But if I'm trying to select the Length then it throws the System.InvalidOperationException: 'Nullable object must have a value.'
Trying to use it as a where filter returns false even though it should be true.
Is Length not yet supported and I have to load the data to evaluate it's length?
I've checked the docs and couldn't find anything useful
The text was updated successfully, but these errors were encountered: