I am thinking of those who are watching your videos for the first time, they will immediately take an aspirin and go to sleep for a week. excellent video by the way.
One of the best OData introductory tutorials on UA-cam! Thank you! I especially loved the part where you troubleshoot stuff. That's where I feel I learn the most.
I'm trying to fetch data from cosmos db and implemented odata in the project (Asp.Net Core Web API built on dotnet 6). I applied filter expression on endpoint, it pulls all the data from cosmos and sends to client what client requested in odata filter expression. So far so good. But the problem is, it's fetching all the records from cosmos. Is there any way to convert the filter expression to a Cosmos query? So that I can pull the records which are required for me. Thanks in advance
When you did a search, for example, search=Name, then the items came back with Name with a capitol N, when the original data had a lower case N. That is a bit concerning if the receiver is not ignoring casing. I have never really used OData before as it seemed like a black box of sorts, but I would assume the data being returned would always be exported the same.
would be good if you had also covered how GET, PUT, PATCH, POST, DELETE can able doe done with ODATA. Also can we string multiple filtering conditions? like get top 100&$filter by score gt 100 or something? Iam just wondering to use JsonPatch vs OData for supporting Patch for my enterprise APIs. what do you suggest?
Thank for your great video, in .net 5,6 released minimal API, so how do combine minimal API and Odata, could you please help me any idea or suggestion? Regards!
Great video, thx ! I have a question: if I add a complex type as a property of the Student class (Address with Street, PostalCode and City properties), the $select=Adress returns always an empty object. What should be the configuration for my example to work ?
$count=true is not working in the nonEDM workflow in the latest Odata Packages(8.1), Can you please provide the hint or suggestions that how's $count will work in Odata
Hi Hassan nice video thanks! But I want to know if it possible use Odata on MinimalAPI. Using the nuget Microsoft.AspNetCore.OData we get the extension method AddOData only on IMVCBuilder interface. But in minimalapi we don't use IMVCBuilder because there are no controllers. There is a way to add ODATA capabilities to minimal api endpoints? Thanks
Thanks Hassan for your useful videos , but how can i consume odata Api in .Net 6 , specially Microsoft Dynamics 365 Apis , it was working on .Net 5 but not available in .Net 6 , do you have a way ? Thanks in advance
(C# ) Is it possible to add some attribute to property in odata endpoint which changes its name. I have case when I want property to have DateTime.Now name
Hi Hassan Once again thanks for all the education you provide. I am getting the following error when running the app. "Message": "The query specified in the URI is not valid. Could not find a property named 'name' on type 'OData6Demo.Api.Models.Student'." I'm running vs2022 and DotNet 6.0.100-preview.5.21302.13 Kind Regards
I have noticed the metadata is not returned in these calls. For instance if I am using top/skip I would expect to see a nexturl as metadata. Is this no longer true?
How does this work? Does the Controller fetch all the data from Service and Data Access Layer but just return the necessary fields according to the OData parameters passed to the API? In real-world scenarios, I would assume that its really inefficient to pull all the data from the DB if there are OData filters present.
The tutorial is good, however there is a question. At this point if you use a database, you first fetch all data at the econtroller level and then the api filters, orderes etc. However ths is a performance hit. The query options need to apply to the db level for performance reaons
Hi Gassan, how can I use $apply in asp net 6 with swagger. I can't find a way to make it work, not even by URL Edit: I need to use "aggregate" in $apply to make a sum of values ( filter(id eq x)/aggregate(TotalAmount with sum as Total) )
I would think it would be the exactly the same as securing any non-odata endpoints. same concept. I'm planning to start a series sometime before the end of the year about securing ASP.NET Core APIs and Blazor Apps.
When I have $Select my request, it's not ending, when I put a breakpoint in the controller, the controller method is done and returned. Anyone has any idea what is causing this behavior?
Hi Brandon, is your code somewhere I can take a look at? I upgraded most of my projects to .NET 6 with OData 8.0.3 and it seems to be working okay. What kind of errors are you getting can you provide the exact text here please?
@@HassanHabib Well it’s not giving me an error, but the responses are incomplete now. With .NET 5 and OData 8.0.1 I get the expected JSON responses, but with .NET 6 the response looks like this: $metadata#Orders”,”value”:[ The response just ends with an open array like that. My startup code looks like this: var builder = new ODataConventionModelBuilder(); builder.EntitySet(“Orders”).EntityType.HasKey(table => new {table.OrderId}); services.AddControllers().AddOdata(opt => opt.Select().Filter().OrderBy().AddRouteComponents(“odata”, builder.GetEdmModel()); The only other thing worth mentioning is my controller inherits from ODataController. Also, I tried with OData 8.0.3 with the same result.
Hi, I like and Best OData tutorials on UA-cam. I have one query for In this version if I want to show "@odata.context" and its value so in this solution or OData Version 8.2.3. So, what I need to do?
I am thinking of those who are watching your videos for the first time, they will immediately take an aspirin and go to sleep for a week.
excellent video by the way.
I wasn't expecting understand odata in just 20 minutes and don't get bored, really good work.
One of the best OData introductory tutorials on UA-cam! Thank you! I especially loved the part where you troubleshoot stuff. That's where I feel I learn the most.
Thank you sir, a ton! I learned OData concept today with your tuition!
Thanks Hassan - really the best Visual Studio OData demo I have found that actually works E2E (you're saving lives).
I like this type of videos where u get what u look for in a very fast pace without wasting time and u get some extra bono content :D
Great intro Hassan, thank you so much! Will it work with ASP.Net Core 7 too? If yes, when. Thanks.
Best for oData overview.. Thanks a lot
Great teacher!
Thank u for making it simple & understandable.
I have become ur great Fan Sir. Thank you for such a good videos
Please add some video on JW Token in .net core i need to learn
Thanks for the video and you got a new subscriber here 😉
I'm trying to fetch data from cosmos db and implemented odata in the project (Asp.Net Core Web API built on dotnet 6).
I applied filter expression on endpoint, it pulls all the data from cosmos and sends to client what client requested in odata filter expression.
So far so good. But the problem is, it's fetching all the records from cosmos. Is there any way to convert the filter expression to a Cosmos query? So that I can pull the records which are required for me.
Thanks in advance
thank you, brother! helped a lot.
What an amazing concept. Thank you.
Thanks, really great introduction!
Amazing video, Thanks a lot Hassan!
this is really helpful right now integrating swagger and odata together is such a pain, i can't wait for .net 6.0 to come out
Very good video, thank you.
So proud of you 👍🏼 👍🏼👍🏼.
BTW, do you have time to do paid freelance tasks?!
No sorry.
excellent video. very well explained
When you did a search, for example, search=Name, then the items came back with Name with a capitol N, when the original data had a lower case N. That is a bit concerning if the receiver is not ignoring casing. I have never really used OData before as it seemed like a black box of sorts, but I would assume the data being returned would always be exported the same.
you are amazing, man
Really nice and handy, thanks!
would be good if you had also covered how GET, PUT, PATCH, POST, DELETE can able doe done with ODATA. Also can we string multiple filtering conditions? like get top 100&$filter by score gt 100 or something? Iam just wondering to use JsonPatch vs OData for supporting Patch for my enterprise APIs. what do you suggest?
Amazing video! can you do a series on the $apply operator?
Great!
nice, thanks
Sir Kindly make video on JWT Nuget package and RefeshTokens
can you demonstrate to how to enable 'Update' capability in this example? I would love to see how you can update the persons dataset
Thanks for the video! Does OData modify the query sent to the database or does it only modify the result received?
I have the same question. Did you find the answer?
If your controller is returning an IQueryable - the query goes straight to the database. Very optimum
@@HassanHabib Could you please tell how to use dto models with odata?
Thank for your great video, in .net 5,6 released minimal API, so how do combine minimal API and Odata, could you please help me any idea or suggestion? Regards!
Great video, thx !
I have a question: if I add a complex type as a property of the Student class (Address with Street, PostalCode and City properties), the $select=Adress returns always an empty object.
What should be the configuration for my example to work ?
$count=true is not working in the nonEDM workflow in the latest Odata Packages(8.1), Can you please provide the hint or suggestions that how's $count will work in Odata
thanks a lot
Hi Hassan nice video thanks! But I want to know if it possible use Odata on MinimalAPI. Using the nuget Microsoft.AspNetCore.OData we get the extension method AddOData only on IMVCBuilder interface. But in minimalapi we don't use IMVCBuilder because there are no controllers. There is a way to add ODATA capabilities to minimal api endpoints? Thanks
OData is not available for minimal API yet. but there's work in progress for that.
@@HassanHabib oh ok thanks so I will wait..:
Can you make a video on Authorization Library for OData ?
Thanks Hassan for your useful videos , but how can i consume odata Api in .Net 6 , specially Microsoft Dynamics 365 Apis , it was working on .Net 5 but not available in .Net 6 , do you have a way ?
Thanks in advance
How do you deal with pulling a million records and then filter? It makes it even worse when you are dealing with processed data..
(C# ) Is it possible to add some attribute to property in odata endpoint which changes its name. I have case when I want property to have DateTime.Now name
Hi Hassan
Once again thanks for all the education you provide.
I am getting the following error when running the app.
"Message": "The query specified in the URI is not valid. Could not find a property named 'name' on type 'OData6Demo.Api.Models.Student'."
I'm running vs2022 and DotNet 6.0.100-preview.5.21302.13
Kind Regards
It's case sensitive - try Name instead of name
@@HassanHabib Thank you
I have noticed the metadata is not returned in these calls. For instance if I am using top/skip I would expect to see a nexturl as metadata. Is this no longer true?
The metadata comes back with the EDM approach for OData. I follow a non-EDM pattern where your API returned body doesn't really change at all.
How does this work? Does the Controller fetch all the data from Service and Data Access Layer but just return the necessary fields according to the OData parameters passed to the API? In real-world scenarios, I would assume that its really inefficient to pull all the data from the DB if there are OData filters present.
The query executes on your storage engine. Controller only exposes an IQueryable and your underlying layer materializes it.
@Hassan Habib, is there a tutorial for versioning with URL segment using OData 8?
The tutorial is good, however there is a question. At this point if you use a database, you first fetch all data at the econtroller level and then the api filters, orderes etc. However ths is a performance hit. The query options need to apply to the db level for performance reaons
That's not true. An IQueryable is a deferred execution mechanism.
Right so if a decontext was injected we could have defined the query without calling .ToListAsync()?
I actually saw another video in the ef standup and basically my question is answered. Thank you very much! Insightful video 🙂
How to make the Id field of student an autogenerated while trying to Create a Student entity and saving to DB
Hi Gassan, how can I use $apply in asp net 6 with swagger. I can't find a way to make it work, not even by URL
Edit: I need to use "aggregate" in $apply to make a sum of values ( filter(id eq x)/aggregate(TotalAmount with sum as Total) )
Hey, OData does not work with MediatR. Any idea how to resolve it?
Do the genererated swagger docs automatically add indications of the additional functionality (select, filter, order by, etc)? Thanks for the video!
I don't think they add instruction for OData queries but it's definitely something to look at in OData NxT.
How can I protect odata endpoints with oauth2? or anything you can recommend
I would think it would be the exactly the same as securing any non-odata endpoints. same concept.
I'm planning to start a series sometime before the end of the year about securing ASP.NET Core APIs and Blazor Apps.
Magic
Still no OdataResourceSerializer for JToken or JObject :(
When I have $Select my request, it's not ending, when I put a breakpoint in the controller, the controller method is done and returned. Anyone has any idea what is causing this behavior?
How to work with XML response with OData? I'm having a problem with it, hope anyone could help
Why don't you have the metadata here and for example count=true.
Whenever I upgrade .NET or OData everything seems to break or all of the APIs change
Hi Brandon, is your code somewhere I can take a look at? I upgraded most of my projects to .NET 6 with OData 8.0.3 and it seems to be working okay. What kind of errors are you getting can you provide the exact text here please?
@@HassanHabib Well it’s not giving me an error, but the responses are incomplete now. With .NET 5 and OData 8.0.1 I get the expected JSON responses, but with .NET 6 the response looks like this:
$metadata#Orders”,”value”:[
The response just ends with an open array like that.
My startup code looks like this:
var builder = new ODataConventionModelBuilder();
builder.EntitySet(“Orders”).EntityType.HasKey(table => new {table.OrderId});
services.AddControllers().AddOdata(opt => opt.Select().Filter().OrderBy().AddRouteComponents(“odata”, builder.GetEdmModel());
The only other thing worth mentioning is my controller inherits from ODataController.
Also, I tried with OData 8.0.3 with the same result.
How do you secure an endpoint?
Is that a piano?
I cannot enable $count Odata function this way
As soon as I remove [Route("[controller]")] it works
Hi, I like and Best OData tutorials on UA-cam. I have one query for In this version if I want to show "@odata.context" and its value so in this solution or OData Version 8.2.3. So, what I need to do?