In query in Entity Frame work
        Posted  
        
            by 
                Syed Salman Raza Zaidi
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Syed Salman Raza Zaidi
        
        
        
        Published on 2012-10-31T10:48:26Z
        Indexed on 
            2012/10/31
            11:00 UTC
        
        
        Read the original article
        Hit count: 261
        
I am working on Entity frame work, i have created a method which is returning List of my Table, I am retrieving data on base of grpID(which is foreign key, so i can have multiple records) I have saved these grpID's in an array so I want to run IN command on Entity framework so that i can get records in single List, How can i apply In command,my code is below
 public List<tblResource> GetResources(long[] grpid)
        {
            try
            {               
                return dataContext.tblResource.Where(c => c.GroupId == grpid && c.IsActive == true).ToList();//This code is not working as i am having array of groupIds
            }
            catch (Exception ex)
            {                
                return ex;
            }
        }
© Stack Overflow or respective owner