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
Attempting to use JsonApiDotNetCore with SQL Server backend.
Receiving all "Teams" works fine.
Attempting to get single "Team" entity with GUID Id field.
Error received:
The LINQ expression 'DbSet
.Where(t => t.Id.Equals((object)__id_0))' could not be translated.
So the filter expression is casting to an object and this cannot be understood by the SQL server ef provider.
I figured that it was because the expression allowed for __id to be nullable, so I added a generic constraint to TId so that is was a non nullable value type (where TId: struct)
This did not make any difference.
Is this a bug with how the expression is being constructed or am I missing something.
public class Team: Identifiable<Guid>
{
[Key]
[Column("TeamId")]
public override Guid Id { get; set; }
[MaxLength(255)]
[Required]
[Attr]
public string TeamName { get; set; }
[HasMany]
public List<TeamPlayer> TeamPlayers { get; set; }
}
...
Environment
JsonApiDotNetCore Version: latest master
Other Relevant Package Versions: ef 3.1.5
The text was updated successfully, but these errors were encountered:
Hi @ClintGood, thanks for your detailed report. This looks like a bug indeed. I'm working on changes in query building where I have already fixed this. Once I have a PR, I'll add a link to here so you can track progress and confirm it fixes your issue.
Attempting to use JsonApiDotNetCore with SQL Server backend.
Receiving all "Teams" works fine.
Attempting to get single "Team" entity with GUID Id field.
Error received:
The LINQ expression 'DbSet
.Where(t => t.Id.Equals((object)__id_0))' could not be translated.
So the filter expression is casting to an object and this cannot be understood by the SQL server ef provider.
I figured that it was because the expression allowed for __id to be nullable, so I added a generic constraint to TId so that is was a non nullable value type (where TId: struct)
This did not make any difference.
Is this a bug with how the expression is being constructed or am I missing something.
...
Environment
The text was updated successfully, but these errors were encountered: