Adding Filtering, Sorting And Pagination To a REST API | .NET 7

Поделиться
HTML-код
  • Опубликовано: 21 ноя 2024

Комментарии • 186

  • @MilanJovanovicTech
    @MilanJovanovicTech  Год назад +6

    Get the source code for this video for FREE → the-dotnet-weekly.ck.page/rest-api-p2
    Want to master Clean Architecture? Go here: bit.ly/3PupkOJ
    Want to unlock Modular Monoliths? Go here: bit.ly/3SXlzSt

    • @rafaelg0225
      @rafaelg0225 Год назад

      That's a hot topic in my dev team right now, we are debating if we should use SignalR or C# HTTP Listener class with and encrypted inbound port and a DNS address, our system are stand alone desktop apps and not web apps, so security is a huge factor.
      Biggest problem with SignalR route has been a reliable way to reconnect automatically :(

  • @CreativeB34ST
    @CreativeB34ST Год назад +7

    On 13:19, you could create an IQueryable extension method that takes the sort order field and your expression and does the decision for OrderBy or OrderByDescending behind the scenes. Removes a bit of boilerplate code that you don't need to copy paste for each search endpoint in your API.

    • @MilanJovanovicTech
      @MilanJovanovicTech  Год назад +1

      I know, that could've been the next step

    • @rasheed9947
      @rasheed9947 9 месяцев назад

      Man You Dont Know How Valueble These Comments are And Its Great Idea im gonna Do It Rn xD

  • @kodindoyannick5328
    @kodindoyannick5328 9 месяцев назад +1

    I've been looking for a channel like yours for a long time and now I found it. It's your channel Milan and I'm so happy. Thank you very much for your knowledge sharing. I still have to find a good mentor on the front end like you are for me on the back end 🙏🙏🙏

  • @zheniachubarov3384
    @zheniachubarov3384 Месяц назад +1

    If we talking about separation of concerns and clean architecture, where am I supposed to put such PagedList?

  • @swift8995
    @swift8995 4 месяца назад

    Where should I put the PagedList model? In the domain layer or in the application?

  • @daveanderson8348
    @daveanderson8348 Год назад +2

    A few years ago I used a library for parsing OData query options called Moon.OData. I could send an OData query and the program translated it into a normal t-sql. Very simple and safe for both user and developer.
    I believe there are more such libraries nowadays. Would definitely recommend that to anyone.

  • @adeni4359
    @adeni4359 Год назад +6

    Have you already done a full tutorial on your channel? I like your teaching style! I wish there is a full tutorial or even a course

    • @MilanJovanovicTech
      @MilanJovanovicTech  Год назад +1

      There's another video for CRUD endpoints

    • @adeni4359
      @adeni4359 Год назад

      @@MilanJovanovicTech I mean a full tutorial from the beginning (Include the setup). This is for us beginners 😁

  • @gusflopes
    @gusflopes Год назад +2

    Waiting for the Dapper version too! Great video.

    • @MilanJovanovicTech
      @MilanJovanovicTech  Год назад +1

      Hah! That would actually be interesting! Adding it to my video backlog 💥

  • @zakariasmahi2263
    @zakariasmahi2263 Год назад +1

    Thanks for sharing this insightful, in all my api projects i use rye same logic for paging, filtering and sorting. For the pagination i return an object that contains items page number and page size as you did, however instead of returning a boolean HasNextPage or HasPreviousPage, i return string which are url for the previous and next pages already prepared (when i'm one the first page, previous page is null and if i'm in the last page next page is gonna be null )so in case one of clients of my api is working on a batch for frtching data url are already prepared by the api 😃
    Thanks for sharing i really like your helpful content

    • @MilanJovanovicTech
      @MilanJovanovicTech  Год назад +1

      HATEOAS, that's smart! I didn't want to introduce that as I thought it would be too much, but I might just prepare that for the next video

    • @mohamedal-qadeery6530
      @mohamedal-qadeery6530 Год назад

      Hello that's really good can you share the code for it ?

  • @rafaelg0225
    @rafaelg0225 Год назад +3

    I had to create something similar but the backend DB was Mongo so I had to use projection, and for the search I used reflection to get the Data Annotation for the BsonElement name and type, the documents had over 150 fields ... It would be nice to add reflection to this tutorial to avoid hard coding the name of the properties, maybe using JsonProperty annotation??? Thanks for the great tutorial

  • @thecodeman_
    @thecodeman_ Год назад +4

    Great, in-detail tutorial!

  •  Год назад +15

    We want the Dapper version too.

    • @MilanJovanovicTech
      @MilanJovanovicTech  Год назад +9

      I see there's demand for it, already added it to my backlog 😁

  • @emirsalihovic6616
    @emirsalihovic6616 Год назад +1

    Bravo doktore 🤝

  • @pilotboba
    @pilotboba Год назад +4

    I highly suggest you determine a maximum page size and use that instead of what the client is requesting if their pagesize exceeds your maximum. :)
    Also, I think I like returning the pagination information in headers, rather than in the response payload.

    • @MilanJovanovicTech
      @MilanJovanovicTech  Год назад +1

      Whoops, missed to mention that! But yeah, that's important to consider. (Can't say I never tried to harass some APIs by seeing if they had a max_page_size on the backedn 😅)

    • @shahryarsaljoughi6073
      @shahryarsaljoughi6073 6 месяцев назад

      How would having pagination information within hdeaders benefit? Is it common?

    • @pilotboba
      @pilotboba 6 месяцев назад

      @@shahryarsaljoughi6073 I prefer keeping paging out of the query string which I reserve for filters.

  • @ramytawfik9168
    @ramytawfik9168 Год назад +1

    Excellent as usual Milan 👌

  • @christianguitarcovers6021
    @christianguitarcovers6021 Год назад +1

    Milan, this was a very useful video tutorial. thx a lot

  • @ccuenca24
    @ccuenca24 Год назад +2

    Excellent video! Really helpful! Thanks for sharing! by the way, can you explain in a short video format the record and sealed modifiers from your perspective and it's importance the documentation not consider optimization benefits. Thanks

  • @Karthik-ug8ll
    @Karthik-ug8ll Год назад +1

    Thanks for this awesome video.I was searching from long time 😊.

  • @jamalalbatta8231
    @jamalalbatta8231 Год назад +2

    I loved the Expression with switch to cover the which column to sort by, in my project I have the same amount of search choices I want to cover, so I'm using if else statements, can you please show case or at least right here as a respond an Expression with switch that is used in Where() instead of OrderBy(). I tried it but I'm messing something and i can't get it to work. Thanks a lot for the video, it helped a lot

  • @gakshay9537
    @gakshay9537 Год назад +3

    Thank you for covering those topics which are helpful in handling performance issues.
    On filtering, if the table has multiple columns, then the number of parameters may grow. is there a generic way to easily achieve it.
    On pagination, if the result fits in 5 pages, the client should call the API for 5 times. So, the end query will be executed 5 times by considering the page number. will it not affect the sql performance

    • @RaZziaN1
      @RaZziaN1 Год назад +1

      For filtering u need to use reflection and build your own - use queryable, there is no in-built solution. For pagination u should add some kind of limit parameter which could be set to number representing numbers of records on each page (Skip + Take)

    • @MilanJovanovicTech
      @MilanJovanovicTech  Год назад +1

      You can achieve most of it with reflection, and there's even a cool library out there called Dynamic.Linq

  • @EHBRod13
    @EHBRod13 Год назад +1

    Your videos are SO good! Thank you for teaching me so much!

    • @EHBRod13
      @EHBRod13 Год назад

      Also, where did you learn these techniques? I'm curious because I feel it's difficult to find good resources and tutorials that use industry standards unless you work in the industry. Or what books do you recommend to learn more about these techniques in depth?

    • @MilanJovanovicTech
      @MilanJovanovicTech  Год назад +1

      1. I do work in the industry 😅 At least I did until this year, now I try to stay in the loop with consulting.
      2. Pluralsight has a lot of good resources for .NET, to be honest. Courses from Kevin Dockx about APIs cover all of this in much more detail.

  • @Rodrick.
    @Rodrick. Год назад +5

    I was expecting something more generic like Sieve for automatic pagination sorting and filtering.
    Or OData or graph

  • @samuniv987
    @samuniv987 Год назад +3

    It seems like a good tutorial but I am having difficulty following your architecture and stuff about record and sku. Are there any prior videos that I need to watch? This has been happening to me for quite a few videos so any help in that will be very appreciated.

  • @cancurva
    @cancurva Год назад +2

    Thank you for the quality content I have a question. For sorting and searching why didnt you use reflection to search or sort in every column. Also if you add new fields you dont need to add new contains to the where part.

    • @MilanJovanovicTech
      @MilanJovanovicTech  Год назад

      I find this approach more explicit, so that's why. You could've also done it with reflection, but it would've been a lot more cumbersome.

    • @allannielsen4752
      @allannielsen4752 Год назад

      normally you apply indexes to search columns

  • @mahmoudabdel-moughiss9950
    @mahmoudabdel-moughiss9950 Год назад +1

    thans alot, this was very useful .🙏🙏

  • @sajithsageer182
    @sajithsageer182 Год назад +1

    Great video as usual. Any chance of an Odata tutorial?

    • @MilanJovanovicTech
      @MilanJovanovicTech  Год назад

      I haven't used it in Production, so I'll see if I can find some time to research it

  • @Guillen8606
    @Guillen8606 Год назад +1

    Could you show us how to implement the sorting if we are using generic classes and we don't know the class attributes before runtime?

    • @MilanJovanovicTech
      @MilanJovanovicTech  Год назад

      You'd need a "smart" mechanism to standardize it, and you'll probably end up using reflection or something similar

  • @phuongtran-qh5kq
    @phuongtran-qh5kq Год назад +1

    Hi Milan, tks for the video. It would be great if you could make a video on the Expression that you created? I could not wrap my head around that.😂

    • @MilanJovanovicTech
      @MilanJovanovicTech  Год назад

      Ah, sorry about that. It's an EF trick I use from time to time. I'll see what I can do

    • @phuongtran-qh5kq
      @phuongtran-qh5kq Год назад

      @@MilanJovanovicTech thanks Milan. What is the keyword of this Expression? i wanna search it up first

  • @azhariagand6930
    @azhariagand6930 10 месяцев назад

    Thanks for the tutorial and great video, Is there a series for this video?

    • @MilanJovanovicTech
      @MilanJovanovicTech  10 месяцев назад

      Yes:
      1) ruclips.net/video/nE2MjN54few/видео.html
      2) ruclips.net/video/X8zRvXbirMU/видео.html
      3) ruclips.net/video/59Ce4O3J7Do/видео.html

    • @azhariagand6930
      @azhariagand6930 10 месяцев назад

      @@MilanJovanovicTech thank you milan

  • @junior.santana
    @junior.santana Год назад +2

    Is there a standard way for adding specific/complex filters? For example, filtering by a date interval or a price range. Creating this in a generic way to be reused in several endpoints

    • @alanbreeee
      @alanbreeee Год назад +6

      Search for odata

    • @MilanJovanovicTech
      @MilanJovanovicTech  Год назад

      Unless you'll be using it in quite a few endpoints, it's probably not worth it implementing a custom abstraction

    • @petherpettersson6152
      @petherpettersson6152 Год назад

      LinqKit has a PredicateBuilder. We add attributes to our search parameter properties that defines what and how comparisons should be applied on what on the search result. Ours handles standard ones, exact, like, ranges, enum matching, lists, nullables, etc. Should be possible to find a start on google.

    • @the-nasim
      @the-nasim Год назад

      ​@@alanbreeeeDoes OData work with the Minimal API?

  • @crazyfox55
    @crazyfox55 Год назад +1

    Does the select hurt performance of the take, skip, or count async? Calling ToListAsync is when the queryable is actually executed but how does it know to reorder the operations in a performant way?

    • @MilanJovanovicTech
      @MilanJovanovicTech  Год назад +1

      No, EF doesn't execute anything until the ToList call - it's only then that everything is assembled into a SQL query so it know how to re-order them to achieve the optimal result

  • @joseagustincarrenogallego3704
    @joseagustincarrenogallego3704 Год назад +1

    Hi! again, I'm glad with your nice explanation!
    But I have a cuple of questions, what about create queries (with pagination as you show us) with multiples tables in our database?
    and by the other hand, what do you think about the EF against the Dapper performance?

    • @MilanJovanovicTech
      @MilanJovanovicTech  Год назад

      Use whichever ORM you like 😁
      And what about create endpoints?

  • @mohamedadel936
    @mohamedadel936 4 месяца назад

    Great! Thanks Milan ❤

  • @Pawelogll
    @Pawelogll Год назад +2

    Why you didn’t use graphql with EF Core ?

  • @azraiqbal187
    @azraiqbal187 Год назад +2

    Really helpful 😊
    Which machine are you using for editing and recoding? Specs
    Thanks 👍

    • @MilanJovanovicTech
      @MilanJovanovicTech  Год назад +2

      Ryzen 7-based machine, RTX 3060, pretty solid setup.

    • @azraiqbal187
      @azraiqbal187 Год назад

      @@MilanJovanovicTech are you using liquid cooling or air cooling for pc ?

  • @tibba69
    @tibba69 Год назад +1

    How would you do dynamic select/projection?

    • @MilanJovanovicTech
      @MilanJovanovicTech  Год назад

      I'd say only if you're not used to the second approach. We can argue for both approaches, if we want to

  • @milanlimbu4417
    @milanlimbu4417 3 месяца назад

    This theme looks beautiful can you provide me the name of it... and Thank for the tutorial Learned alot from you

  • @krccmsitp2884
    @krccmsitp2884 Год назад +1

    17:22 "by incrementing the page *number" 😉

  • @phw1009
    @phw1009 Год назад +1

    Ahhhh .... you are amazing

  • @joseantonioteransuarez6840
    @joseantonioteransuarez6840 Год назад +1

    Great video, but I have a question: is it possible to reference the DBContext from the application layer with a clean architecture?

    • @MilanJovanovicTech
      @MilanJovanovicTech  Год назад +1

      It's possible - but it "breaks" the architecture

    • @oziomaene7335
      @oziomaene7335 Год назад

      Good question @joseantonio
      Please can you explain what you mean by break the architecture. @MilanJovanovicTech
      I recently worked on a project where I fetched data as queryables. I did this by creating the interface for each entities' repository in the application layer and then implementing it in the infrastructure layer.
      Do you have a better way to achieve this.

    • @mahmoudsayed133
      @mahmoudsayed133 2 месяца назад

      I have the same consideration,
      So i was creating an interface in application layer *IApplicationDbContext* and it contains all DbSet's and methods like saveChanges and others that you need in application layer,
      then let your DbContext implements IApplicationDbContext and add it to dependency injection
      And then you can use IApplicationDbContext through application layer.

  • @codingbloke
    @codingbloke Год назад +6

    This is good stuff. EF is fine when returning simple entities from the DB. At 13:46 I would have taken the refactoring a little further and eliminate the "8-liner" (as I like to to call those if..else pairs that simply assign a variable) with the ternary operator.
    I'm not a fan the PageList stuff, returning the TotalCount is a very expensive choice with, IMO, limited value. Whether there is a previous or next page is of even less value. (E.g. I know I just got page 1 so I don't really need the server to tell me there isn't a previous page and for reasonable page sizes (say 20) 95% of the time I can tell there is no next page because the count of results returned is < pageSize). I prefer the simplicity of just returning the set of results but I guess it is down to your specific use cases.

    • @davearkley7014
      @davearkley7014 Год назад +1

      >> returning the TotalCount is a very expensive choice
      An extra 86ms on my desktop machine with a 1000000 row table

    • @codingbloke
      @codingbloke Год назад +1

      @@davearkley7014 Were you filtering a text value using a contains predicate? How many concurrent users are also demanding an extra 86ms of DB servers' time? That's huge right?

    • @vivekkaushik9508
      @vivekkaushik9508 Год назад

      I had the same idea reg ternary operator.

    • @nothingisreal6345
      @nothingisreal6345 Год назад

      I would need to check if EF converts the CountAsync into SELECT COUNT(*) FROM (

    • @codingbloke
      @codingbloke Год назад +2

      @@nothingisreal6345 No that still will not be "ok". Pretty sure it does do that and without any criteria the DB could respond with internal stats it maintains, it won't have to actually count records.
      However, if you are using say a Name Like '%' + term + '%' its going have to do a table scan, and search each string. Considering the use case for this feature is pretty weak to start with, I personally don't include this in my designs.

  • @reinoboonstra
    @reinoboonstra Год назад +1

    Thank you, very helpful. Nice clean coding as well 👍

  • @itsabhinav100
    @itsabhinav100 Год назад +1

    How do you rate Biarity Sieve for Sorting , Filtering and Pagination? although it has some challenges for VO or complex types

    • @MilanJovanovicTech
      @MilanJovanovicTech  Год назад +1

      I can't rate it since I never used it 🤷‍♂️

    • @odd2b1
      @odd2b1 Год назад +1

      I love that library and other one which i use is Gridify

  • @devilspower100
    @devilspower100 Год назад +1

    The issue on 06:00 is it because of value object thing having setup with valueConverters? I run into this issue a few times.

  • @PGWalkthrough
    @PGWalkthrough 11 месяцев назад +1

    can you post the result query generated by EF? It would be nice to know how its being done in Sql Server.

    • @MilanJovanovicTech
      @MilanJovanovicTech  11 месяцев назад +1

      Will try if I can find some time - but nothing special, just your standard WHERE/ORDER BY/OFFSET query

    • @PGWalkthrough
      @PGWalkthrough 11 месяцев назад

      @MilanJovanovicTech thanks for your reply. I am actually trying to implement pagination and sorting in sql query but i dont seem to find the best approach. The main problem is sorting as they mainly recommend to have a massive switch statement with a case for every column in the table or i have to write a dynamic query but have the risk of sql injection as the column name param is coming from front end. Thanks.

  • @swift4511
    @swift4511 2 месяца назад

    Can I use the CreateAsync method of the PagedList with the repository, build the query inside method, and then pass it to the PagedList? Or is it better to move CountAsync() and ToListAsync() out of the PagesList to maintain separation of concerns?

    • @MilanJovanovicTech
      @MilanJovanovicTech  2 месяца назад

      Sure, you can just pass in the pre-computed data to PagedList

  • @Wfmike
    @Wfmike Год назад +1

    Sorting input can be a bit better using enum string.

  • @toragodzen
    @toragodzen Год назад +1

    Could you make implicit operator for Sku, so we will remove type casting and just use Sku where string is expected?

    • @MilanJovanovicTech
      @MilanJovanovicTech  Год назад +1

      EF has to know that you want it to be a string and not a Sku :/

    • @allannielsen4752
      @allannielsen4752 Год назад

      A better approach in my opinion since it is a value object is to use a EF Converter... Sku.HasConversion... I think it is.

  • @grzegorzfedoryka5045
    @grzegorzfedoryka5045 Год назад +1

    You could do sorting using dynamic linq
    public static IQueryable SetOrdering(this IQueryable query,
    string orderColumn, string orderingDirection)
    {
    if (string.IsNullOrEmpty(orderColumn))
    {
    return query;
    }
    return query.OrderBy($"{orderColumn.Trim()} {orderingDirection.Trim().ToLower()}");
    }
    Ofc column and sort order would be validated in validation step

  • @valcron-1000
    @valcron-1000 7 месяцев назад

    At 21:02 aren't you performing the query twice at the DB level? Once to get the `totalCount` and a second one to get `items`? If so, how can we avoid this?

    • @MilanJovanovicTech
      @MilanJovanovicTech  7 месяцев назад +1

      This is a typical issue with this type of pagination. You could write SQL and a batched query that would fetch both values in one round trip.

  • @khanfaizan05
    @khanfaizan05 6 месяцев назад

    Wonderful. Thanks ❤

  • @beaufindlay2832
    @beaufindlay2832 Год назад

    Thanks for the great video, I've followed your clean architecture course which is great too. I'm building a project off the back of that and wondering how you've structured the IApplicationDbContext interface here to use directly in the handler as oppose to a repository interface as the DbContext is in the infrastructure layer. How is this interface being registered in the DI container? Do you have any code examples of what that interface could look like?

    • @MilanJovanovicTech
      @MilanJovanovicTech  Год назад

      services.AddDbContext(_rest of ef config_);
      You can use this overload 👆

  • @zheniachubarov3384
    @zheniachubarov3384 Месяц назад

    Could you please show how to unit test internal classes?

  • @ДаниїлТерентьєв
    @ДаниїлТерентьєв Год назад +1

    Thank you for useful video! I was wondering, whether we are able to create generic method for sorting not only for the specific class, but for all entites. Is it possible to do in correct way? Because I tried and it looks like sh!t)

    • @MilanJovanovicTech
      @MilanJovanovicTech  Год назад +1

      Yes you can! What does it look like?

    • @ДаниїлТерентьєв
      @ДаниїлТерентьєв Год назад

      @@MilanJovanovicTech for now, I used specification pattern. Was inspired by your previous video). In my test assignment I receive sorting and paging via query parameters, which can be null. Therefore I decided to create specification inheritor from base specification. And IN RUNTIME apply different things, like sorting by column name and so on to it. It is not predefined like you shown in the video. What do you think about this. Is this a good approach? Thank you for reply :)

  • @EnriqueAndreHernandezLeon
    @EnriqueAndreHernandezLeon 9 месяцев назад

    OMG you're the man! Thanks

  • @swift8995
    @swift8995 4 месяца назад

    Can I return the PagedList with a list of domain models from the repository and map it in a query handler to a PagedList of DTOs to send as a response?

  • @cristhianjuliancubides6269
    @cristhianjuliancubides6269 Год назад +1

    I have a question, you are getting all the products with context.Products, if I have 5000 items it gets them all and then you are applying the filtering. Therefore the filter would not make sense because the objects are being loaded into memory and then the paging is applied.
    I have a doubt, thank you

    • @MilanJovanovicTech
      @MilanJovanovicTech  Год назад

      No, the first is just an IQueryable and it doesn't touch the database until we call ToListAsync

    • @cristhianjuliancubides6269
      @cristhianjuliancubides6269 Год назад

      Milan, but when I debug the IQueryable already has all the results, without the TolistAsync, why does this happen?, I am waiting for your answer, thanks

    • @matthewrossee
      @matthewrossee Год назад

      @@cristhianjuliancubides6269 Probably because debugger triggers the evaluation of the iqueryable so you can see the results. Are you sure you don't click something like "show me the results (this will force the enumeration)"?

  • @GeekDriven
    @GeekDriven Год назад

    Any thoughts on creating a tutorial for Cursor Pagination or any other types along with explaining the benefits of the same? As always great videos. 😇

  • @alang39564
    @alang39564 8 месяцев назад

    How would you approach a case where you need to paginate child entites of an aggregate?

    • @MilanJovanovicTech
      @MilanJovanovicTech  8 месяцев назад +1

      How would that work from an API consumer perspective?

    • @alang39564
      @alang39564 8 месяцев назад

      @@MilanJovanovicTech let's say you have a Shop (aggregate root) which has N employees and you want to get api/shop/{shopId)/employees?page=1&pageSize=10

  • @MaksymVasylyshyn-dx8hy
    @MaksymVasylyshyn-dx8hy 7 месяцев назад

    How about use approach which use only 3 models it's: PaginationOptions, SortingOptions, FilteringOptions and use enum instead string in case sorting for example, it's make code more cleaner and remove reducant parameter, I wish to know how to implement this thank, you, I can share the post in LinkedIn where I find it

  • @mariomandzukic8676
    @mariomandzukic8676 4 месяца назад

    Is there a way to set up filtering and orderby to be like pagedlist generic?

    • @MilanJovanovicTech
      @MilanJovanovicTech  4 месяца назад

      With paged list it's easy to fetch current page / count all records. But how would you build generic filtering with different entity types?
      I'm sure we can come up with some abstraction to provide the desired filter and sorting. But is it worth it?

    • @mariomandzukic8676
      @mariomandzukic8676 4 месяца назад

      @@MilanJovanovicTech Yes was wondering about that since orderby and filtering dont look if i may say appealing to me but as you say its not worth it to go that deep in abastraction

  • @Tamer_Ali
    @Tamer_Ali Год назад +1

    Hi Milan, thank for the video.
    are you going to refactor the sorting method to be extension method and generic?
    var list =await context
    .Users
    .OrderDescendingByField(nameof(User.Name)) // OrderByField for asc
    .ToListAsync();

    • @MilanJovanovicTech
      @MilanJovanovicTech  Год назад

      Yeah, could be doable - not planning on it. But perhaps with reflection.

    • @petherpettersson6152
      @petherpettersson6152 Год назад

      System.Linq.Dynamic.Core makes it possible to just order by a string, a little easier but will need to check if the column is valid in some other way,

  • @VegaAldrinM
    @VegaAldrinM Год назад

    Hi, what if in page 2 and tried to search an item available in page 1 do I still get that item? Or every search is need to reset the pageNumber to 1?

  • @jesusorozco294
    @jesusorozco294 Год назад +1

    With Dapper?

  • @SureshKumar-rz7dn
    @SureshKumar-rz7dn Год назад +1

    I use a nuget package called sieve to does this .

  • @mrwalkan
    @mrwalkan Год назад +2

    Why not GrapaQL?

  • @jayakumar2927
    @jayakumar2927 Год назад +1

    Source code needed

  • @idanqwe1
    @idanqwe1 8 месяцев назад

    will that work with .net 6?

  • @wolfgang5945
    @wolfgang5945 8 месяцев назад

    How to view MVC with it 🤔? I was trouble

  • @nghianguyen170192
    @nghianguyen170192 Год назад +2

    with OData, you dont need to do all implementation by youself.

  • @RafiXWPT
    @RafiXWPT Год назад +1

    Actually what you did there is very bad. The much better solution in to make thing more generic by create more interfaces and base query handlers. Also, way you doing sorting is ugly. You can just use reflection and make it work with whatever object you like without any problem. I created such generic mechsnism in my project using cqrs and efcore and developers who are using it loves that you can add new lists in just minute by inheriring some base generic classess

    • @MilanJovanovicTech
      @MilanJovanovicTech  Год назад +2

      I'm still a junior engineer, don't be so rude

    • @RafiXWPT
      @RafiXWPT Год назад

      @@MilanJovanovicTech you are junior? Though you are senior who create content for less experienced devs. Sorry then.

    • @OlivierDALET
      @OlivierDALET Год назад +2

      @@MilanJovanovicTech Don't mind him! Your content was pretty good!
      No reflection means better speed, base classes and generic interfaces may be needed if you were to craft a general-purpose lib such as Sieve or AutoQueryable, but what you demonstrated simply allows anyone aiming at this goal to get started and generalize any way they'd like
      What's more, promoting heavily layered and generic architecture is at the very least debatable (Heard of the heated debate between cmuratori and uncle Bob of "clean code" fame? One comes from the native video game world where performance is paramount, the other is a book-author consultant who goes full with DI, virtual dispatching and OO patterns). From bare-bone C-like code to 50-layer architectures there's a middle ground, but I must admit that, age helping, I'm leaning more and more towards the less abstraction side (and I've been professionally using C# for 20y now)
      Simply said, there's nothing in this video you'd have to feel ashamed of. Even as a senior dev, I found inspiration here for my own use cases!

    • @MilanJovanovicTech
      @MilanJovanovicTech  Год назад +1

      @@OlivierDALET Thanks a lot, I appreciate it. I'm not really a junior, just messing with OP a little. I do tend to not overcomplicate my videos, and let the viewer find what value he can and take it from there into their own implementation. If they choose to make it more complex and entirely generic, that's great for them.

  • @kdakan
    @kdakan Год назад +1

    Too much coding to deliver such a simple standard feature. I have a library that does this and much more without any coding.

    • @MilanJovanovicTech
      @MilanJovanovicTech  Год назад +4

      Sometimes it's good to know the fundamentals, instead of reaching for a library for everything

  • @techpc5453
    @techpc5453 Год назад +2

  • @techpc5453
    @techpc5453 Год назад +1