I am using LINQ to select bulk data(156000 Records) from DB. But am getting the following error.
An exception of type 'System.OutOfMemoryException' occurred in System.Data.Entity.dll but was not handled in user code
Am using select query as follows,
var allCompanies = from s in db.Data.AsNoTracking().ToList()
select s;
Please help me to resolve this issue
ToList(), you are trying to materialize the whole table in memory. Try selecting just the fields you need, or better still, filter the data before materializing it.AsNoTracking()will load deep copies of duplicate rows, not sure if this is relevant to your query?