I have a conversion error in my program. I use a method to query db (with Entity Framework) and get all the entries of a table Web_Groups_joint_Profils
:
public partial class Web_Group_joint_Profils
{
[Key]
[Column(Order = 0)]
[StringLength(255)]
public string GroupName { get; set; }
[Key]
[Column(Order = 1)]
[DatabaseGenerated(DatabaseGeneratedOption.None)]
public int IDProfil { get; set; }
}
And here is the method to get all rows:
public List<Web_Group_joint_Profils> GetGroupAndId()
{
var grpId = context.WebGroupProfil
.Select(a => new
{
GroupName = a.GroupName,
IDProfil = a.IDProfil
}).ToList();
return grpId;
}
But grpId
is invalid :
Impossible to implicitely convert type "System.Collections.Generic.List<> to System.Collections.Generic.List"
When I hover on the declaration ToList()
it says
Creates a List<T> of an IEnumerable<out T>
So I have tried changing the return type
List<IEnumerable<T>>
without success. I'm guessing my linq query creates an anonymous type I don't know how to handle.