✅ IEnum and IQueryable usage.
My Controller action is here.
The pagination example from docs uses IQueryable so I was doing this to get the IEnum from the sorting part above to work with it.
It says
decksIQ
is equal to the filtered down decks
Enum after processing the first line, but the third line when passing decksIQ
in the parameter says it's the full unfiltered list again. Why would this happen?7 Replies
Here's the pagination method
you realize
deckIQ
and decksIQ
are not the same variable rightoh my gosh.
I wonder how many problems I didn't need to try and solve.
I do have a particular question about this too, I'm just seeing if that fixed it before asking and changing the subject 🤣
Okay that brings me back to my first problem.
InvalidOperationException: The source 'IQueryable' doesn't implement 'IAsyncEnumerable<MTGDeckBuilder.DataModels.Deck>'. Only sources that implement 'IAsyncEnumerable' can be used for Entity Framework asynchronous operations.
You shouldn't be calling
AsEnumerable()
on the dbsetOh alright. I had tried getting the sorting / filter if statements to work with an IQueryable but I couldn't figure it out
InvalidOperationException: The LINQ expression 'DbSet<Deck>() .Where(d => d.Name.Contains( value: __filter_0, comparisonType: OrdinalIgnoreCase))' could not be translated. Additional information: Translation of method 'string.Contains' failed. If this method can be mapped to your custom function, see https://go.microsoft.com/fwlink/?linkid=2132413 for more information. Either rewrite the query in a form that can be translated, or switch to client evaluation explicitly by inserting a call to 'AsEnumerable', 'AsAsyncEnumerable', 'ToList', or 'ToListAsync'. See https://go.microsoft.com/fwlink/?linkid=2101038 for more information.Sorry m8 I just don't understand what this is telling me. Okay so I can't use that
Contains(asdf, StringComparison)
bitits saying it doesn't understand how to translate that contains method to sql
Yeah I got that part bud.
sorry wasn't meant to sound snary. Just saying I understand that much.
I'm finding there isn't an option for this in EFcore. Should I just ToUpper or something before saving to database and search accordingly?
Well that worked for now. Thanks for the help. I could have sworn I tried this at the beginning and it didn't work but 🤷🏻♂️ . Probably something goofy like another typo.