Hi folks,
i've got the following linq2sql query, and i'm setting the result to a POCO. One of my POCO properties is an enumeration.
public IQueryable<Models.Achievement> GetAchievements()
{
return from a in _sqlDatabase.Achievements
select new Models.Achievement
{
// Note: ToEnum is an extension method that converts an int -> the enum.
AchievementType = a.AchievementTypeId.ToEnum<Models.AchievementType>(),
DateTimeCreated = a.DateTimeCreated,
UserId = a.UserId
};
}
When i run the query, i get the following error.
System.NotSupportedException: Method 'Models.AchievementType
ToEnum[AchievementType](int)' has no supported translation to SQL.
hmm. is there a way i can be tricky enough to make the result int get converted to my custom enum?