0

I have a data table with several xml fields. I'm using EF to get the data using where:

List<tblMSASAN> msa = ctx.tblMSASANs.Where(s => s.LCMGSupportLevel != "decommissioned").ToList();

Then using a foreach to iterate the list and pulling the xml field into an xmldocument and querying each node updating an attribute, then saving the context.

However, the dataset is too large and I get an out of memory exception. So I need to be able to query the xml first to return a smaller dataset.

List<tblWinServer> servers = ctx.tblWinServers.AsNoTracking().Where(s => s.LCMGSupportLevel != "decommissioned" && ( Convert.ToString(s.TapeDrives).Contains("Calyx") ||Convert.ToString(s.DiskShelves).Contains("Calyx"))).ToList();

But this doesn't work with a NotSupportedException.

Any ideas?

1

1 Answer 1

-1

AsNoTracking() method returns IQueryable but if you want to use ToString() method in Where clause you have to convert IQueryable to IEnumerable:

List<tblWinServer> servers = ctx.tblWinServers.AsNoTracking().AsEnumerable().Where(s => s.LCMGSupportLevel != "decommissioned" && ( Convert.ToString(s.TapeDrives).Contains("Calyx") ||Convert.ToString(s.DiskShelves).Contains("Calyx"))).ToList();
Sign up to request clarification or add additional context in comments.

1 Comment

This is exactly what the OP does not want: " the dataset is too large".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.