Expression of type System.Linq.Expressions.ConstantExpression is not supported
See original GitHub issueNot sure why this exception happen has 3 nodes: Game, GameInfor, User
This query run well on neo4j match (g:Game)-[:GAME_HAS_GAMEINFOR]->(n:GameInfor)<-[:USER_HAS_GAMEINFOR]- (u:User) where g.Name = ‘GreenDNA’ return n,u order by n.SupportScore limit 10
but couldn’t make it run on Neo4jClient
graphClient.Cypher
.Match("(g:Game)-[:GAME_HAS_GAMEINFOR]->(n:GameInfor)<-[:USER_HAS_GAMEINFOR]-(u:User)")
.Where("g.Name = 'GreenDNA'")
.Return((n, u) => new SupportRank
{
User = u.As<SocialUser>(),
GameInfo = n.As<UserGameInfo>(),
Position = 0
})
.Results;
Error: Expression of type System.Linq.Expressions.ConstantExpression is not supported thrown
public class SupportRank
{
public SocialUser User { get; set; }
public UserGameInfo GameInfo { get; set; }
public int Position { get; set; }
public SupportRank(){}
public SupportRank(SocialUser user, UserGameInfo gameInfo, int position)
{
this.User = user;
this.GameInfo = gameInfo;
this.Position = position;
}
}
public class SocialUser
{
public string Username { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public int Year { get; set; }
public int Month { get; set; }
public int Day { get; set; }
public string Gender { get; set; }
public string Country { get; set; }
public string AvatarURL { get; set; }
public bool isLogged { get; set; }
public bool IsBanned { get; set; }
public SocialUser()
: base()
{
}
public SocialUser(string username, string firstName, string lastName,
int year, int month, int day, string gender, string country,
string avatarURL, bool isLogged, bool isBanned)
{
this.Username = username;
this.FirstName = firstName;
this.LastName = lastName;
this.Year = year;
this.Month = month;
this.Day = day;
this.Gender = gender;
this.Country = country;
this.AvatarURL = avatarURL;
this.isLogged = isLogged;
this.IsBanned = IsBanned;
}
}
public class UserGameInfo
{
public string ID { get; set; }
public int AchievementDifficulty { get; set; }
public double UserAbility { get; set; }
public string GameInfo { get; set; }
public int NoCorrect { get; set; }
public int NoIncorrect { get; set; }
public string ArrayDifficulties { get; set; }
public int SupportScore { get; set; }
public int ShareScore { get; set; }
public int AchievementScore { get; set; }
public UserGameInfo()
{
}
public UserGameInfo(string id, int achievementDifficulty, double userAbility,
string gameInfo, int noCorrect, int noIncorrect, string arrayDifficulties,
int supportScore, int shareScore, int achievementScore)
{
this.ID = id;
this.AchievementDifficulty = achievementDifficulty;
this.UserAbility = userAbility;
this.GameInfo = gameInfo;
this.NoCorrect = noCorrect;
this.NoIncorrect = noIncorrect;
this.ArrayDifficulties = arrayDifficulties;
this.SupportScore = supportScore;
this.ShareScore = shareScore;
this.AchievementScore = achievementScore;
}
}
Issue Analytics
- State:
- Created 8 years ago
- Comments:14 (7 by maintainers)
Top Results From Across the Web
c# - Neo4jClient - Expression of type System.Linq. ...
Expression of type System.Linq.Expressions.ConstantExpression is not supported. the query is simple: return await _graphClient.Cypher.
Read more >Expression of type System.Linq.Expressions. ...
An exception of type 'System.NotSupportedException' occurred in Neo4jClient.dll but was not handled in user code Additional information: ...
Read more >ConstantExpression Class (System.Linq.Expressions)
Represents an expression that has a constant value.
Read more >Nuqleon.Linq.CompilerServices
This library provides allow list scanners that check expressions against a given list of allowed items. Two different types are provided:.
Read more >Dynamically Generating LINQ Expressions
This gives Entity Framework and similar libraries the opportunity to take the LINQ expression and transform it into an SQL query.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
As a work around - I would use the
With
clause to set your bool const:using the following class as the return class.
Thanks! Perfect