I am using version 3.1 Final dated 2/22/2012 in adapter mode.
I am trying to write a generic method to remove entities based on a list of entities.
public void Delete<T>(IEnumerable<T> entites) where T : class, new()
{
var q = entites.AsQueryable();
var col = ((ILLBLGenProQuery)q).Execute() as IEntityCollection2;
this.Adapter.DeleteEntityCollection(col);
}
The above Execute call is not working. I get this exception:
Unable to cast object of type 'System.Linq.EnumerableQuery`1[BidService.Server.Db.Llbl.Generated.EntityClasses.BidEntity]' to type 'SD.LLBLGen.Pro.LinqSupportClasses.ILLBLGenProQuery'.
What did I do wrong?
Thank you.