I know you must say this post is duplicated, but I've already gone to multiple posts and the answers don't work on my code.

This is an Asp net web api server. Take a look:

```
    // GET: api/Vessels
    [HttpGet, Route(""), Route("{assets}")]
    public IQueryable<Vessel> GetVessels(string assets = "all")
    {
        var user = GetUser();

        if (IsAdmin(user))
        {
            return assets == "all"
                ? GetChildren(db.Vessels)
                : db.Vessels;
        }

        var claims = user.Claims
            .Where(c => c.ClaimType == "vessel")
            .ToList();

        var vessels = db.Vessels
            .Where(v => claims.Any(c => v.Id == int.Parse(c.ClaimValue)))
            .toList(); // will evaluate the query and get error

        return assets == "all"
            ? GetChildren(vessels)
            : vessels;
    }

```

and this is the exception:

> 
> An exception of type 'System.NotSupportedException' occurred in EntityFramework.SqlServer.dll but was not handled in user code
>  Additional information: Unable to create a constant value of type 'Microsoft.AspNet.Identity.EntityFramework.IdentityUserClaim'. Only primitive types or enumeration types are supported in this context.
> 
> 
> 

On my tests I realised that the error is in this block:

```
claims.Any(c => v.Id == int.Parse(c.ClaimValue))

```

If I change it to 5 or anything else, it works!