Комментарии:
Source code needed
Ответитьthans alot, this was very useful .🙏🙏
ОтветитьWhy you didn’t use graphql with EF Core ?
ОтветитьWith Dapper?
Ответить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.😂
Ответить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
Sorting input can be a bit better using enum string.
Ответитьwith OData, you dont need to do all implementation by youself.
ОтветитьGreat video as usual. Any chance of an Odata tutorial?
ОтветитьThanks for this awesome video.I was searching from long time 😊.
Ответить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?
ОтветитьYour videos are SO good! Thank you for teaching me so much!
Ответить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
ОтветитьExcellent as usual Milan 👌
ОтветитьHow do you rate Biarity Sieve for Sorting , Filtering and Pagination? although it has some challenges for VO or complex types
Ответить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
Too much coding to deliver such a simple standard feature. I have a library that does this and much more without any coding.
Ответить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
ОтветитьThank you, very helpful. Nice clean coding as well 👍
ОтветитьMilan, this was a very useful video tutorial. thx a lot
Ответить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. 😇
ОтветитьHow would you do dynamic select/projection?
Ответить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.
You could do sorting using dynamic linq
public static IQueryable<Tsource> SetOrdering<Tsource>(this IQueryable<Tsource> 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
I use a nuget package called sieve to does this .
ОтветитьWaiting for the Dapper version too! Great video.
Ответить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.
Ответить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.
We want the Dapper version too.
Ответить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
ОтветитьGreat video, but I have a question: is it possible to reference the DBContext from the application layer with a clean architecture?
Ответить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();
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?
Ответить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
ОтветитьI was expecting something more generic like Sieve for automatic pagination sorting and filtering.
Or OData or graph
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
ОтветитьBravo doktore 🤝
ОтветитьWhy not GrapaQL?
Ответить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
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
Ответить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.
ОтветитьCould you make implicit operator for Sku, so we will remove type casting and just use Sku where string is expected?
ОтветитьAhhhh .... you are amazing
ОтветитьGreat, in-detail tutorial!
ОтветитьReally helpful 😊
Which machine are you using for editing and recoding? Specs
Thanks 👍