Entity framework 6 system.outofmemoryexception

I keep getting system.outofmemoryexception:

An exception of type "System.OutOfMemoryException" was thrown. in System.Collections.Generic.List 1.set_Capacity(Int32 value) at System.Collections.Generic.List1.EnsureCapacity (Int32 min) in System.Collections.Generic.List 1.Add(T item) at System.Collections.Generic.List1..ctor (IEnumerable 1 collection) at System.Linq.Enumerable.ToList[TSource](IEnumerable1 source) in CIGDataLibrary.Archive.ArchiveCycleData (String applicationName) in c :! TFS \ SCCSoftware \ Commercial \ CIG \ Wagering \ CIGDataLibrary \ files \ Archive.cs: line 571

Code on line 571:

List<Guid?> cycleData = Queries.Current.GetCycleDataArchiveList();

Method:

public static List<Guid?> GetCycleDataArchiveList()
{
    using (var dbContext = new CIGDataModels.CIGDBStoredProcModels())
    {
        return dbContext.usp_arch_GetCycleData().ToList();
    }
}

And the meat stored procedure:

SELECT TOP 1000 gpCycleData_Id FROM CIGDB.dbo.cig_Cycle_gpCycleData
WHERE [TimeStamp] < DATEADD(HH, 3, DATEADD(dd, 0, DATEDIFF(dd, 0, GETDATE())))
ORDER BY [TimeStamp]

Any thoughts on why this is happening? It should return 1000 records (only a list of GUIDs), so you should not drop the fit, right? I took SP to TOP 1, but still leads to the same error.

+4
2

. , TOP n, , .

, proc, , .

, , , , :

  • - .
  • Entity . , , .
  • . , myApp MyProc, myApp.MyProc dbo.MyProc.
0

, , .

, 572, 571.

List<Guid> arch_gpCycle = dbarchContext.cig_Cycle_gpCycleData.Select(s => s.gpCycleData_Id).ToList();

system.outofmemoryexception. , , .

0

All Articles