Hi all
I am trying to do the following code:-
public List<ClientRegionEntity> GetClients()
{
var metadata = GetDataContext();
var Contracts = (from cr in metadata.ClientRegion
select new {IDClient = cr.IDClient});
return (List<ClientRegionEntity>) Contracts;
}
Its a simple LINQ select, and I do not need the select new {}, however I am doing it because I will need to use it in another more complex query.
When I run this code, I am getting the following error:-
Unable to cast object of type 'SD.LLBLGen.Pro.LinqSupportClasses.LLBLGenProQuery1[<>f__AnonymousType2
1[System.Int32]]' to type 'System.Collections.Generic.List`1[Enhesa.BusinessObjects.Adapter.EntityClasses.ClientRegionEntity]'.
I would like someone to point me in the right direction
Thanks for your help and tim
Johann