thanks so much for your work! Can you do the video on IQueryProvider interface. I have to write UT for my project but i got the error "the source 'iqueryable' doesn't implement 'iasyncenumerable moq". Then i do the search on stackoveflow they said i have to create Linq Provider for my List which i have to implement IQueryProvider, but i dont know how to implement this interface. thanks
That's so stupid. Extension methods should be dynamic dispatch. This is something most people will never know until they run into an obscure bug that will take hours to debug
@@CodingTutorialsAreGo why? Linq is basically a bunch of extensions methods. The problem is that extension methods are not virtual (not possible in c# as far as I know). If extension methods could be overridden in this example count in IQueryable could override the IEnumerable count in this object instance. And since IQueryable is a nearer supertype it would be chosen instead of the IEnumerable one.
@@redcrafterlppa303 The problem is that a LINQ query supports multiple interfaces, for example both IEnumerable and IOrderedEnumerable, which have different extensions methods. IEnumerable only has an OrderBy() extension method, whereas IOrderedEnumerable also has a ThenBy(). If it worked polymorphically, then all queries would have to provide ThenBy(), but would give a runtime error if the query hadn't previously been ordered. It could have been made to work that way, but using static binding means we get compile time errors rather than runtime errors, which is generally a good thing. But there are downsides, as described in the video.
@@CodingTutorialsAreGo Every implementation decision has its ups and downs. In this example they probably didn't even think about it because c# simply doesn't support virtual extensions without some manual trickery. It just brakes the "use the highest interface possible" guideline because of the changed behavior.
What do you think of using ToList() method and creating two methods one for the listing of customers and the other for the count of customers. What do you think of this approach?
Source code available here: github.com/JasperKent/IQueryable-vs-IEnumerable
You have created best C# video on youtube. Thanks a lot Sir
You are most welcome; many thanks.
Thank you for the great explanation!
Amazing video! Thank you so much, clear and understandable
Amazing!
simple , clear and easy to understand
That's an awesome explanation, thanks a million.
thanks a million. this channel is a gem
I would like to see more videos on C#, EF Core and Design pattern
Wow this video was so helpful
Great explanation. Thanks. Just subscribed.
thanks so much for your work! Can you do the video on IQueryProvider interface. I have to write UT for my project but i got the error "the source 'iqueryable' doesn't implement 'iasyncenumerable moq". Then i do the search on stackoveflow they said i have to create Linq Provider for my List which i have to implement IQueryProvider, but i dont know how to implement this interface. thanks
I'll put it on the list.
@@CodingTutorialsAreGo thanks so much!
Noob question: How do I run the .sql command? Is it possible to do in Visual Studio 2019?
You mean run a file with a '.sql' suffix?
@@CodingTutorialsAreGo Yes, the CreateSampleDB.sql in the Git repo. :)
amazing tutorials, like!
thanks for the explanation! only one thing I didn't get: your line under your goatee is not exactly centred and it buggged me towards the end. LOL
Imagine how I feel!
As Always a very informative and good Video Thank you! :)
Could you make a Video about Logging?
That would be very nice
I'll put it on the list.
Thanks :) more c# videos :)
Thanks!
Many thank. great
Спасибо огромное тому, кто добавил русские субтитры :)
I hadn't noticed someone had done that done that. Спасибо also from me.
В яндекс браузере можно ещё и озвучку включить (★ ω ★)
thanks alot!
Nice 👍
Cheers!
Cool
I can see nothing, cause your font made me blind!
Yeah - this was my first video. You live and learn.
That's so stupid. Extension methods should be dynamic dispatch. This is something most people will never know until they run into an obscure bug that will take hours to debug
Problem is that LINQ simply wouldn't work without static binding.
@@CodingTutorialsAreGo why? Linq is basically a bunch of extensions methods. The problem is that extension methods are not virtual (not possible in c# as far as I know). If extension methods could be overridden in this example count in IQueryable could override the IEnumerable count in this object instance. And since IQueryable is a nearer supertype it would be chosen instead of the IEnumerable one.
@@redcrafterlppa303 The problem is that a LINQ query supports multiple interfaces, for example both IEnumerable and IOrderedEnumerable, which have different extensions methods. IEnumerable only has an OrderBy() extension method, whereas IOrderedEnumerable also has a ThenBy(). If it worked polymorphically, then all queries would have to provide ThenBy(), but would give a runtime error if the query hadn't previously been ordered. It could have been made to work that way, but using static binding means we get compile time errors rather than runtime errors, which is generally a good thing. But there are downsides, as described in the video.
@@CodingTutorialsAreGo Every implementation decision has its ups and downs. In this example they probably didn't even think about it because c# simply doesn't support virtual extensions without some manual trickery. It just brakes the "use the highest interface possible" guideline because of the changed behavior.
What do you think of using ToList() method and creating two methods one for the listing of customers and the other for the count of customers. What do you think of this approach?
Not sure what you mean.
Awesome explanation. Thank you.