News for hackers. Stuff that matters.
Re:Net 9.0 LINQ Performance Improvements by pjc50 on Friday October 18, 2024 @08:13AM (#41878661)
> It's pretty well put together but it was very hard to work out the patterns of what it was doing underneath e.g. I could not tell you now how to implement a custom IQueryable

There's a lot hidden in there, but basically they expect you to use EF. Writing an IQueryable is a similar amount of work to writing a SQL query planner. You get passed a tree of Expression objects.

https://learn.microsoft.com/en-us/archive/blogs/mattwar/linq...

Re:Net 9.0 LINQ Performance Improvements by SideburnsOfDoom on Friday October 18, 2024 @09:34AM (#41879320)
> basically they expect you to use EF. Writing an IQueryable...

I don't agree. I don't feel any expectation to use EF. It would not be relevant anyway to our code.

LINQ is not EF and EF is not LINQ. EF uses LINQ but not vice versa. LINQ is useful without EF.

The LINQ extension methods that we use constantly are on IEnumerable<T> so EF and IQueryable is of no importance to us, but LINQ is used everywhere.

Re:Net 9.0 LINQ Performance Improvements by pjc50 on Friday October 18, 2024 @11:41AM (#41880438)
> IQueryable is of no importance to us

I was discussing IQueryable with someone else to whom it was important. In reply to

> I could not tell you now how to implement a custom IQueryable (I know where to look but couldn't tell you the rhythms of it) for some database

And "for some database" the default answer is "use EF" as the intermediary between LINQ queries and the database itself, rather than delving into IQueryable.

LINQ-to-objects is very important and useful but I was talking about something else.

Re:Net 9.0 LINQ Performance Improvements by SideburnsOfDoom on Saturday October 19, 2024 @04:30AM (#41886496)
My apologies, that reply of mine was a bit argumentative, without regard to which post I was arguing against.

Yes, I understand that implementing IQueryable is a beast, but let's not pretend that writing a database connectivity layer was a trivial, everyday activity before IQueryable. It's a specialised, tricky task. IQueryable may not make it easier, but it never was "easy" per se. Nor common, or usually necessary. Or something to do as an exercise "before using something for a serious project" as the grandparent post suggests.

YMMV as to how important IQueryable is to your code.

On the other hand, if you can write extension methods over "this IEnumerable<T> source" you can extend LINQ. IQueryable being complex is no barrier to that, in any way.

Re:Net 9.0 LINQ Performance Improvements by christophilus on Friday October 18, 2024 @12:15PM (#41880802)
Back when I was primarily a C# dev, I used OSS lightweight ORMs which had LINQ interfaces. I also frequently used LINQ on in-memory structures. It's fantastic, and I never felt any need to use EF.

That said, C# / .NET shops did have a tendency to mindlessly buy into all sorts of terrible Microsoft enterprisey stuff. That drove me crazy and ultimately is what made me head out for greener pastures.

Re:Net 9.0 LINQ Performance Improvements by grugagag on Friday October 18, 2024 @09:19PM (#41884884)
What are those greener pastures for you and do you still use C#?