Supercharging your Web APIs with OData and ASP.NET Core

แชร์
ฝัง
  • เผยแพร่เมื่อ 31 ธ.ค. 2024

ความคิดเห็น • 280

  • @robertkamenski9248
    @robertkamenski9248 5 ปีที่แล้ว +69

    Nice explanation by JSON Momoa!

    • @69bitboy
      @69bitboy 4 ปีที่แล้ว +1

      😂😂😂

    • @PerryCodes
      @PerryCodes 3 ปีที่แล้ว +1

      HAHAHAHAHAHA. Thank you. I haven't laughed that hard in a while :)

    • @HassanHabib
      @HassanHabib 3 ปีที่แล้ว

      LOL

    • @navdeepsingh9463
      @navdeepsingh9463 2 ปีที่แล้ว

      😂

  • @richardholguin3481
    @richardholguin3481 5 ปีที่แล้ว +244

    There are two types of developers, a LOT of stickers or NO stickers

    • @chadmwest
      @chadmwest 5 ปีที่แล้ว +4

      Truer words have never been spoken.

    • @levinjay3376
      @levinjay3376 5 ปีที่แล้ว +1

      Hahah! :)

    • @thilehoffer
      @thilehoffer 5 ปีที่แล้ว +1

      I have 3 stickers on my laptop.

    • @gabrielmoreyra3365
      @gabrielmoreyra3365 5 ปีที่แล้ว +1

      @Sharty Waffles Sure. That's why Jeremy is MVP and you're not.

    • @gabrielmoreyra3365
      @gabrielmoreyra3365 5 ปีที่แล้ว

      @Sharty Waffles I believe you they're experts. But I don't believe they got there by not sticking anything to their laptops.

  • @fabienl.7569
    @fabienl.7569 5 ปีที่แล้ว +53

    Who needs GraphQL when you have OData ? Wonderful! 🙌

    • @bryanwood9965
      @bryanwood9965 5 ปีที่แล้ว +2

      I always love Remote Code Execution

  • @userdfourdfive1788
    @userdfourdfive1788 5 ปีที่แล้ว +16

    This is great for simple solutions where EF context is tightly coupled to API. What about solutions that have a core project with domain models, services and repositories and where every piece is resolved dynamically when the solution is running?

  • @saravanansomu8296
    @saravanansomu8296 11 หลายเดือนก่อน

    This is a great way to explain OData. Loved the grocery store analogy. thanks.

  • @F2H16
    @F2H16 2 ปีที่แล้ว

    Thanks, Hassan and Jeremy for such a nice intro.

  • @yaynative
    @yaynative 7 หลายเดือนก่อน

    I love when standards are open and powerful.

  • @Night3scape
    @Night3scape 5 ปีที่แล้ว +9

    Amazing, thanks a lot. that was amazing intro, now I need to figure out how to integrate it with ASPCore Policy Based Authorization, to control Entity extending and other OData Features..

  • @mihirp8013
    @mihirp8013 5 ปีที่แล้ว +2

    Thanks for making OData super easy to implement with core! Can’t wait to add additional “4 Lines of Code” to all my API projects. 👍🏻

  • @BrendanKnowles
    @BrendanKnowles 5 ปีที่แล้ว +2

    Hassan, you're a legend - this is exactly what I was looking for!

    • @HassanHabib
      @HassanHabib 5 ปีที่แล้ว +3

      Thank you Brendan, I think the legends are the visionaries and engineers behind this technology, I'm just trying to bring their amazing work to light.

  • @RaviMittal84
    @RaviMittal84 5 ปีที่แล้ว +24

    I have a question,
    Does that Odata operations happening directly on Database OR it's happening afterwards on the result set??

    • @HassanHabib
      @HassanHabib 5 ปีที่แล้ว +29

      If your return type is an IQueryable it runs on the database.

    • @ibrahimozgon
      @ibrahimozgon 5 ปีที่แล้ว

      medium.com/@ibrahimozgon/asp-net-core-odata-query-database-over-url-820624beef92

    • @aah134-K
      @aah134-K 5 ปีที่แล้ว

      @@HassanHabib ya habib
      How about if it is entity framework?

    • @HassanHabib
      @HassanHabib 5 ปีที่แล้ว +8

      @@aah134-K if you materialize your data coming from EF as a list then it runs in memory, if you run on an IQueryable DataSet in EF then it runs on the database.

    • @odairto
      @odairto 5 ปีที่แล้ว

      @@HassanHabib I did it and the SQL intercepted its a full SQL. This is my github, if you want to see: github.com/odairto/ODataEF

  • @cmcki2008
    @cmcki2008 5 ปีที่แล้ว +1

    This got to be the best video I’ve seen while working in IT. Thank you 😊

    • @HassanHabib
      @HassanHabib 5 ปีที่แล้ว

      Thank you for watching :-)

  • @matiascasagrande7759
    @matiascasagrande7759 4 ปีที่แล้ว +1

    Is there a way to inject the OData filtering capabilities outside the Controller? Like in a Service layer perhaps?

  • @RemusTMUTHOMI
    @RemusTMUTHOMI 5 ปีที่แล้ว +4

    Great demo 👍👏, worth every second

  • @balramsingh4759
    @balramsingh4759 5 ปีที่แล้ว +3

    Very well explained, thanks

  • @rans0101
    @rans0101 3 ปีที่แล้ว

    Great, thank you Hassan!

  • @rongliao9255
    @rongliao9255 5 ปีที่แล้ว +2

    Great tutorial! Thanks a lot!

  • @hck1bloodday
    @hck1bloodday 5 ปีที่แล้ว +7

    great lternative to the current trend of GraphQL, and i really like this approach , with graphQl you overfetch from the db nd filter on the server, this uses Entity framework to filter in the database

    • @marcel830
      @marcel830 5 ปีที่แล้ว +1

      You misunderstood GraphQL. You can also use the Entity Framework to filter in the DB.

    • @hck1bloodday
      @hck1bloodday 5 ปีที่แล้ว +3

      @@marcel830 sure, but you have to spicify the queries that will apply those filters, then you loose the benefict over rest

  • @xelaksal6690
    @xelaksal6690 4 ปีที่แล้ว

    Magic:) Thank you for this demo.

  • @Ashwath-p8c
    @Ashwath-p8c 5 ปีที่แล้ว +1

    Nice video! 2 questions.
    1. If I have a response like this
    {
    id:"123",
    "metadata": {
    "branch": "master"
    }
    },
    {
    id:"1234",
    "metadata": {
    "branch": "master"
    }
    },
    {
    id:"1235",
    "metadata": {
    "branch": "master1"
    }
    },
    how do I $select just the branch property?
    2. How can i select only the distinct branches? (master and master1 in this case?)

  • @abhishekbedre
    @abhishekbedre ปีที่แล้ว

    If you notice, the response without the $expand and $filter the API follows the camelCase and once you add the $filter or $expand it omits the default camelCase.

  • @ASPCook
    @ASPCook 5 ปีที่แล้ว

    I've seen a company that used OData in a large size application. And I only have one advise about it:
    OData or even GraphQL are good if you can chuck your application to small size services or you will close the door of updating your project to newer technolgies forever. Then the life will be so hard! :D

  • @acidfoxx52
    @acidfoxx52 3 ปีที่แล้ว

    What reference is being used that is not part of the "4 lines" of code?

  • @tarakpatel85
    @tarakpatel85 4 ปีที่แล้ว +1

    $count is not working with endpoints.EnableDependencyInjection();, it works without and adding routeBuilder.MapODataServiceRoute("ODataRoute", "odata", GetEdmModel(app.ApplicationServices)); in .UseMvc(). Any suggestion how $count work with endpoints.EnableDependencyInjection()?

  • @Robinhopok
    @Robinhopok 5 ปีที่แล้ว +3

    Really interesting. Are there any libraries which make generating Typescript clients possible? I'm also curious if OData can be used for add/update/delete operations. I guess I'll check out the docs!

    • @HassanHabib
      @HassanHabib 5 ปีที่แล้ว +5

      Of course, we will be discussing this in detail in an upcoming videos.

    • @sugeshangovindsamy6220
      @sugeshangovindsamy6220 ปีที่แล้ว

      Wow !!! So you can code and be the best football player in the world 🤣🤣🤣🤣🤣

  • @BenHayat
    @BenHayat 4 ปีที่แล้ว

    Two great guys.

  • @subhashmishra2326
    @subhashmishra2326 4 ปีที่แล้ว

    Nicely explained..
    Awesome..Thanks a lot!

  • @LogicLabyrinth
    @LogicLabyrinth 5 ปีที่แล้ว +2

    I wonder if this implementation is paving the way for support for GraphQL, or will it always be a divergent solution? At minimum, definitely a promising addition for standard APIs.

    • @HassanHabib
      @HassanHabib 5 ปีที่แล้ว +1

      OData actually existed before GraphQL, in fact OData is a lot more powerful than GraphQL check out the comparison here:
      www.progress.com/blogs/rest-api-industry-debate-odata-vs-graphql-vs-ords

  • @bullsinhell
    @bullsinhell 5 ปีที่แล้ว +2

    Hassan - First of all, a really cool demo.
    Is it possible to use the above with a return type as HttpResponseMessage for my Get action (.NET Core 2.0 - Web API)?

  • @Emis333
    @Emis333 4 ปีที่แล้ว +1

    That's an amazing capability, good to know :)

  • @andreigalkin
    @andreigalkin 3 ปีที่แล้ว

    Hey. Is any one seen a recent example how to unit test a controller with ODataQueryOptions filter. I am having a trouble to create it of mock it. All example which i found do not work with the .net 5. Thanks

  • @jo0h4n18
    @jo0h4n18 4 ปีที่แล้ว

    If you're having an api which executes an specific store procedure for that specific endpoint, then you can change the output by altering the store procedure right? This can be done without having to build and release an new version of the api that now needs a new functionality to the routebuilder.

  • @12SecondsToLive
    @12SecondsToLive 5 ปีที่แล้ว +1

    The end of video mention it works with Classic ASP.NET, I assume that's ASP.NET WebAPI .NET Framework? Is there an example setting that up?

    • @HassanHabib
      @HassanHabib 5 ปีที่แล้ว

      Yup, that's exactly what I meant, in fact it's even simpler in ASP.NET Web API with .NET Framework, you still gonna have to add OData service, but then you don't have to do the dependency injection part, just add [EnableQuery] to your controller and you should be good to go!

    • @HassanHabib
      @HassanHabib 5 ปีที่แล้ว +1

      Here's an example: th-cam.com/video/raRCU2sbDSg/w-d-xo.html

  • @stelathsyncllc1085
    @stelathsyncllc1085 5 ปีที่แล้ว +1

    Really good stuff. Thank you.

  • @borschetsky
    @borschetsky 5 ปีที่แล้ว +3

    Amazing!
    Thank you a lot!

  • @LinusBenjamin
    @LinusBenjamin 5 ปีที่แล้ว +2

    Great stuff! Thanks a lot!

  • @arturoescutialopez1900
    @arturoescutialopez1900 5 ปีที่แล้ว +11

    It would be great than you could map queried data to a DTO, for me It's not quite a good idea to allow your whole entity structure be shown to clients

    • @Emis333
      @Emis333 4 ปีที่แล้ว +1

      You can create automappers to map your model structure to a viewmodel structure where you show just enough.

    • @mkraft467
      @mkraft467 2 ปีที่แล้ว

      Automapper and projection is working very well with OData and EFCore

  • @DutchThought
    @DutchThought 4 ปีที่แล้ว +1

    When can we plug this into 3.1? Great work.

    • @offline_meetup
      @offline_meetup 4 ปีที่แล้ว +1

      I didn't test it yet, but here is an article from Hassan about OData in asp.net core 3.1 devblogs.microsoft.com/odata/experimenting-with-odata-in-asp-net-core-3-1/

  • @DunckingTest
    @DunckingTest ปีที่แล้ว

    omg this is awsome maaaagic

  • @guillermoacosta8849
    @guillermoacosta8849 5 ปีที่แล้ว

    Hi @
    Hassan Habib! Great video and explanation! Thank you! I have a question: to practice, I'm play around Chinook databases (do you know?), and "expand" don't work for me, using it like you in your video. The result json show the value items like [ ]. The relation on databases through foreing key, indexes, etc are fine. Summarizing, it does not show the values tied by navigation properties. Please, can you give me any clue that may be failing? Thanks in advance!

  • @gleamofcolor
    @gleamofcolor 4 ปีที่แล้ว

    Those 4 lines of code did work in .net core 3.1 . I have to do other config changes as well. Pls update this video with latest .net core version at least 3.1 onwards

  • @mkraft467
    @mkraft467 2 ปีที่แล้ว

    Thanks guys amazing demo. But I have one question which I am having a hard time to figure out: is it possible to have both the existing WebAPI and the OData service leaving side by side but to access it with a different prefix like this ?
    api/Students -> WebAPI
    odata/Students -> OData
    I am using .NET 6 / AspnetCore.OData 8

  • @WholeNewLevel2018
    @WholeNewLevel2018 5 ปีที่แล้ว +1

    this is simply amazing

  • @joshmccall
    @joshmccall 5 ปีที่แล้ว +2

    Great video!

  • @tuhamustefa6588
    @tuhamustefa6588 3 ปีที่แล้ว

    WoW, it's super Amazing

  • @userdfourdfive1788
    @userdfourdfive1788 5 ปีที่แล้ว +1

    Is there some possibility with the Expand feature to expand to only one level of relationship and not unlimited levels. This will prevent the user to query the whole database.

    • @idgafa
      @idgafa 5 ปีที่แล้ว +1

      [EnableQuery(MaxExpansionDepth = 1)]

  • @sehulugh
    @sehulugh 3 ปีที่แล้ว

    Wow, I got an Api to add a few lines of code and a client App to rebuild, thanks

  • @DennisTuckersAwesome
    @DennisTuckersAwesome 4 ปีที่แล้ว

    Is there a git repo for this example?

  • @Surenzzzaaa
    @Surenzzzaaa 4 ปีที่แล้ว +1

    Thank You...

  • @EaswaranParamasivam
    @EaswaranParamasivam 4 ปีที่แล้ว

    It saves more time.. thanks!

  • @ingamx
    @ingamx 4 ปีที่แล้ว +1

    thats really good. tnx

  • @JuanDavidMaya
    @JuanDavidMaya 3 ปีที่แล้ว

    if a want to have this automatically for every table in my database how I could achieve this without using Entity Framework and map every table manually?

  • @klfr2900
    @klfr2900 4 ปีที่แล้ว

    Isn´t OData also about the format, not only how to query the data? Does this also comes with the ASP.NET Core OData Package, how many lines of code would it took to add that? :)

  • @satish8000518289
    @satish8000518289 5 ปีที่แล้ว +1

    Thank you Friends. it was awesome experience. I have worked with repository patten in that case what i can do.

    • @HassanHabib
      @HassanHabib 5 ปีที่แล้ว

      Still works, as long as your repository object returns an IEnumerable or IQueryable.

  • @songlover1072
    @songlover1072 2 ปีที่แล้ว

    how to get the XML response with OData? because I'm having a problem retrieving it, hope anyone could help.

  • @emaung
    @emaung 4 ปีที่แล้ว +2

    Guys how can exposing the whole dbContext in controller to the world is the good idea?

    • @matiascasagrande7759
      @matiascasagrande7759 4 ปีที่แล้ว

      That is exactly what im asking to myself, also i just asked if there is a way to pass the filter options to an underliying layer like a Service Layer to perform the filtering in that layer and not in the controller

  • @dhanushkakodituwakku5165
    @dhanushkakodituwakku5165 5 ปีที่แล้ว +1

    What's the best approach to make it case insensitive?

    • @JH-qe3fu
      @JH-qe3fu 5 ปีที่แล้ว

      Answer is?

  • @ThoNguyen-ns6jh
    @ThoNguyen-ns6jh ปีที่แล้ว

    good job, thanks

  • @ismaegonzales5
    @ismaegonzales5 5 หลายเดือนก่อน

    Esto me ayuda mejorar 🎉😊

  • @puravupadhyay2961
    @puravupadhyay2961 3 ปีที่แล้ว

    When a another REST API is consumed by a Web API, is it a good idea to use OData?

  • @ericjhuneespa3381
    @ericjhuneespa3381 5 ปีที่แล้ว

    When i use odata with async task await . . using the expand .. it is not working why ??

  • @cyril113
    @cyril113 3 ปีที่แล้ว

    The funny thing is, the initial JSON response had lower case keys and the OData responses capital case keys. Pascal case is just weird.

  • @arunkumarparthasarathy6424
    @arunkumarparthasarathy6424 5 ปีที่แล้ว +2

    Superb

  • @kalaiselvanra
    @kalaiselvanra 5 ปีที่แล้ว +3

    Interesting stuff.

  • @MichaelRosendahl2013
    @MichaelRosendahl2013 5 ปีที่แล้ว +1

    Nice demo, specially if you have an open API, but is there any way to map queries to DTOs and more importantly use AuthorizationHandler?

  • @UniversB3
    @UniversB3 5 ปีที่แล้ว

    Très belle démonstration d'OData, Merci.
    J'aurai bien aimé savoir comment et surtout à quelle moment les données sont traités (filtre, select,... )
    Est ce que c'est vraiment au moment de l'exécution de la requête dans la base de données où une fois remontée, mais ça reste en mémoire côté serveur ?
    Merci beaucoup

  • @mhawkpiece
    @mhawkpiece 5 ปีที่แล้ว +1

    Awesome!!

  • @akuhndevelopers1989
    @akuhndevelopers1989 5 ปีที่แล้ว +1

    Supper amazing!!

  • @DennisTuckersAwesome
    @DennisTuckersAwesome 4 ปีที่แล้ว

    When I download the example and run it, it brings back the student and the school when I just request students.I thought you would only get students and if you did expand=School then you would get school info? The sample code doesn't behave like the video.

  • @ibrahimozgon
    @ibrahimozgon 5 ปีที่แล้ว +1

    Does OData query on DB via Entity framework or does it only query on the results?

    • @HassanHabib
      @HassanHabib 5 ปีที่แล้ว +10

      It depends on the return type, if your controller method is returning a IEnumerable it will perform differently than if it was returning IQueryable. if it's IQueryable OData will perform the search on the database via EF, if it's IEnumerable it will perform the query on the returned results. hope this helps.

    • @ibrahimozgon
      @ibrahimozgon 5 ปีที่แล้ว +1

      @@HassanHabib This is great answer and really great feature. Thank you for the very informative video

    • @davidpereira6982
      @davidpereira6982 5 ปีที่แล้ว +1

      @@HassanHabib This is awesome, because I guess most of ASP.NET Core APIs return IEnumerables from the injected services in the controllers. If you only need 4 lines of code to do all of this, it's f*cking magic! I would like to know how performance is affected with OData, but so far it's quite impressive. Thank you guys, loving all your stuff you are doing and I really hope .NET Core 3 will be a boom in the Software Development world.

  • @consolednd
    @consolednd 5 ปีที่แล้ว

    For the secure reason, I don't want to share full entity from DataContext. Can I use OData for IQueryable instead of an entity?

    • @HassanHabib
      @HassanHabib 5 ปีที่แล้ว

      Yes of course, you have full control over your return type on the controller method.

  • @marianbencat6658
    @marianbencat6658 5 ปีที่แล้ว +1

    So... it is basically method interceptor / middleware.. right? Exposing IQueryable is good only for pretty small applications (RAD), because it is leaky abstraction - even with queryable mapping.
    This is mapping Querystring -> LINQ expression.
    Despite i am big critic of GraphQL/ ODATA because of their low usability in real big and performant applications i liek this idea, because it is easy to use and cool transfer-size optimizations.
    @hassan how does the expand work without EF and .include() extension method? Just ignored? or you can modify mapping of that via configurations?

  • @jacobneroth
    @jacobneroth 5 ปีที่แล้ว

    Out of context , how you do map open types in odata to entity framework core ?

  • @Lan0NT
    @Lan0NT 5 ปีที่แล้ว

    Great. How to working odata with unit of work?

    • @HassanHabib
      @HassanHabib 5 ปีที่แล้ว

      What do you mean? please elaborate.

  • @alexandershubert573
    @alexandershubert573 ปีที่แล้ว

    Amazing, how now with .net 6 all of this needs to be re-recorded

  • @KarlRhodesUK
    @KarlRhodesUK 5 ปีที่แล้ว

    Cool... Now how do I use consume an OData service in ASP.Net Core 3?

  • @MrKhaledpage
    @MrKhaledpage 4 ปีที่แล้ว

    well explained!

  • @thilehoffer
    @thilehoffer 5 ปีที่แล้ว +1

    Does this work with .net Core 3.0?

    • @HassanHabib
      @HassanHabib 4 ปีที่แล้ว +1

      Yes, here's how to do it: devblogs.microsoft.com/odata/experimenting-with-odata-in-asp-net-core-3-1/ and here as well: devblogs.microsoft.com/odata/enabling-endpoint-routing-in-odata/

  • @sandyhills12
    @sandyhills12 5 ปีที่แล้ว +1

    This looks interesting. I was trying to add routeBuilder to -
    app.UseWebApi() ( my app uses this). But I am not able to pass the routeBuilder predicate to this. Can someone help me out please?

    • @HassanHabib
      @HassanHabib 5 ปีที่แล้ว

      Could elaborate more? what are you trying to do?

    • @sandyhills12
      @sandyhills12 5 ปีที่แล้ว +1

      @@HassanHabib In Startup Configure(IAppBuilder) -> i am using app.UseWebApi(config) instead of UseMvc. And UseWebApi does not have routebuilder as argument. Can we somehow make this work with webapi as well?

    • @HassanHabib
      @HassanHabib 5 ปีที่แล้ว

      @@sandyhills12 I see. if you're okay with going to 6 lines of code instead of 4 - you can do this: gist.github.com/hassanhabib/a63297a55e802157b353525c9d420363

  • @Turbosmurfen73
    @Turbosmurfen73 5 ปีที่แล้ว +1

    Love it!

  • @SasanSalem
    @SasanSalem 5 ปีที่แล้ว

    Do it bring all list into ram and process it in ram? Or query applied on Database? Its very important!

    • @HassanHabib
      @HassanHabib 5 ปีที่แล้ว +2

      If you're running against an IQueryable, it will all run on the database.

    • @SasanSalem
      @SasanSalem 5 ปีที่แล้ว +1

      @@HassanHabib that's great. thank you very much.

  • @farrukhkhan967
    @farrukhkhan967 5 ปีที่แล้ว

    How did you came out of this error
    "IServiceCollection' does not contain a definition for 'AddOData' and no accessible extension method 'AddOData' accepting a first argument of type 'IServiceCollection' could be found (are you missing a using directive or an assembly reference?)"
    P.S: I am using the same directive as you used. i.e.
    using Microsoft.AspNet.OData.Extensions;
    please help me.

    • @HassanHabib
      @HassanHabib 5 ปีที่แล้ว

      Did you install the right nuget package?

    • @farrukhkhan967
      @farrukhkhan967 5 ปีที่แล้ว +1

      @@HassanHabib I figured it out. Thanks. I was using .net core for OData and we need other nuget package i.e. .netcore package to install and then do the samething.

  • @UnrealSPh
    @UnrealSPh 5 ปีที่แล้ว

    Hi! Good video, thank you! What about restier for asp.net core?

    • @HassanHabib
      @HassanHabib 5 ปีที่แล้ว

      Thank you for watching, we will try to address that.

  • @y.5107
    @y.5107 5 ปีที่แล้ว

    Why is it bad to use a field like _context in this example? Was his only point to skip the underscore/rename it and use this.context instead?

    • @HassanHabib
      @HassanHabib 5 ปีที่แล้ว

      Use a prefix for field names doesn't follow C# naming conventions/guidelines, this was a practice that was carried over from C++, here's the coding guideline reference: docs.microsoft.com/en-us/dotnet/standard/design-guidelines/names-of-type-members
      This also is a good reference:
      docs.microsoft.com/en-us/dotnet/standard/design-guidelines/general-naming-conventions

  • @elgunlee
    @elgunlee 5 ปีที่แล้ว

    Hi. I hava a question. Is routeBuilder.EnableDependencyInjection(); required? As far as I know we can already use DI in controllers without writing this.

    • @HassanHabib
      @HassanHabib 4 ปีที่แล้ว

      Yes, it's required for your non-Edm route

  • @dotnetdevni
    @dotnetdevni 5 ปีที่แล้ว +1

    What about auto lookup the schools against the school name

    • @HassanHabib
      @HassanHabib 5 ปีที่แล้ว

      You can using filtering to do that, so you can do $filter=Name eq 'School Name Here' something like that.

  • @anomepani
    @anomepani 5 ปีที่แล้ว

    Where we can find source code which you have given in Demo?

    • @HassanHabib
      @HassanHabib 5 ปีที่แล้ว

      Right here: github.com/hassanhabib/ODataDemo

  • @brunoccs
    @brunoccs 5 ปีที่แล้ว

    Is it affecting the database query or just the return from the API?

    • @HassanHabib
      @HassanHabib 5 ปีที่แล้ว

      If you're returning an IQueryable, it will run on the database.

  • @yanaraldaghestani6305
    @yanaraldaghestani6305 5 ปีที่แล้ว +1

    amazing

  • @bobbyv3
    @bobbyv3 5 ปีที่แล้ว +1

    Are those 13 or 15" Surface Book 2s?

  • @baris7971
    @baris7971 5 ปีที่แล้ว

    oData is great. But sadly it breaks Swagger API Doc. Is there any Workaround for this behaviour?

  • @lestersantiago510
    @lestersantiago510 5 ปีที่แล้ว

    Can certain capability be required per service? Like, api/Students needed to be filtered or paged?

    • @HassanHabib
      @HassanHabib 5 ปีที่แล้ว

      As long as it's an API then it's OData-capable :-)

    • @lestersantiago510
      @lestersantiago510 5 ปีที่แล้ว

      @@HassanHabib my question isn't clear. Let me try it again. If the filter has been enabled via Startup.cs, can it be required per endpoint. In the case of api/Students, filter must be supplied, else it'll throw an error. Is that possible?

    • @HassanHabib
      @HassanHabib 5 ปีที่แล้ว

      I see what you're saying, yes you can make it per endpoint by passing a paramter through the [EnableQuery()] annotation that I used in the demo, for instance you can say: [EnableQuery(AllowedQueryOptions = Microsoft.AspNet.OData.Query.AllowedQueryOptions.Expand)] so this way you're only allowing expand but not anything else, there are more things you can do with the EnableQuery annotation to do a per-endpoint control work, does that answer your question?

    • @lestersantiago510
      @lestersantiago510 5 ปีที่แล้ว +1

      @@HassanHabib Yes, you definitely did. Thank you. This will be really nice. This means that even though an IQueryable must be returned in order to run the query in the DB, it can prevent getting unfiltered data by requiring the endpoint to supply a filter. Cool stuff. 👍

  • @ashfaqshaikh7041
    @ashfaqshaikh7041 5 ปีที่แล้ว

    Is it also available in asp.net web or mvc framework

    • @HassanHabib
      @HassanHabib 5 ปีที่แล้ว

      Yes, here's an example: th-cam.com/video/ZCDWUBOJ5FU/w-d-xo.html

  • @Impenneteri
    @Impenneteri 5 ปีที่แล้ว +1

    Isn't this the same with APIs that uses RQL?

    • @HassanHabib
      @HassanHabib 5 ปีที่แล้ว +2

      Very, very similar, Open Data Protocol has a lot of different implementations RQL seems to be one of these implementations.

  • @julioalmeida4645
    @julioalmeida4645 5 ปีที่แล้ว +21

    Show now an integration of OData with Swagger and you will have my slow clap

    • @mspasiuk
      @mspasiuk 5 ปีที่แล้ว +2

      Same here, I added the OData to my controller, and works, but swagger don't. Im using net core 2.1

    • @HassanHabib
      @HassanHabib 5 ปีที่แล้ว +25

      @@mspasiuk I'm working with the OData team to get this officially released - should be out officially shortly.

    • @vincentnwonah7637
      @vincentnwonah7637 5 ปีที่แล้ว +1

      @Hassan Habib Thanks!

    • @aah134-K
      @aah134-K 5 ปีที่แล้ว

      🤣🥳🥳🥳

    • @erichughes1460
      @erichughes1460 5 ปีที่แล้ว +1

      i did it at work this month ;)

  • @joelmamedov404
    @joelmamedov404 4 ปีที่แล้ว

    Well, if you want the client-side capability more than service end-point can provide, then, in essence, you need to write SQL type query. To do that, you need to know the data schema of the source system.
    If you are going to that direction, then I would question the whole idea of the service concept and service encapsulation.

  • @AndreyMir
    @AndreyMir 5 ปีที่แล้ว +1

    Is it similar to GraphQL?

    • @HassanHabib
      @HassanHabib 5 ปีที่แล้ว +6

      GraphQL is similar to OData, since OData came out first in 2007.

  • @ZeVS777
    @ZeVS777 5 ปีที่แล้ว

    Interesting if I can do that with Dapper on SQL server... And also it would be great to have explanations for net core 3.0

    • @HassanHabib
      @HassanHabib 5 ปีที่แล้ว +2

      We will make more videos around the subject and touch on net core 3.0

    • @muhammadfaridahamat8838
      @muhammadfaridahamat8838 4 ปีที่แล้ว

      @@HassanHabib One year on, do you have video on this subject? Can you share here if you do, I can't find anything on this.

  • @martinscheringa8765
    @martinscheringa8765 3 ปีที่แล้ว

    If i query schools and want to $epand all the students as a list it is not working. Can any one tell me what goes wrong?

  • @somebodytocode
    @somebodytocode 5 ปีที่แล้ว +2

    impressive