GraphQL API with .NET 5 and Hot Chocolate

Поделиться
HTML-код
  • Опубликовано: 2 окт 2024
  • In this step-by-step tutorial I take you through how build a GraphQL API using C#9, .NET 5 and the Hot Chocolate framework.
    The video covers:
    Application Architecture Overview
    GraphQL theory and core concepts
    Building Queries
    Multi-threaded queries using Pooled DBContextFactory
    Sorting & Filtering
    Building Mutations
    Building Subscriptions (real-time event notifications with Web Sockets)
    Level: Intermediate
    📕 My Book: www.apress.com...
    🤩 Patreon Site (Exclusive Member Benefits!): / binarythistle
    📕 Webhooks Course on Udemy: www.udemy.com/...
    💻 GitHub Repo: github.com/bin...
    🔗 WSL Install: docs.microsoft...
    🔗 Installing Docker in WSL: docs.docker.co...
    🔗 Visual Studio Code: code.visualstu...
    🔗 SQL Server Express: www.microsoft....
    🔗 Visual Studio: visualstudio.m...
    🔗 Insomnia: insomnia.rest/
    🔗 SQL Server on Docker: hub.docker.com...
    🔗 SQL Server Management Studio: aka.ms/ssmsful...
    🔗 GraphQL Voyager: github.com/API...
    🔗 GraphQL Official Site: graphql.org/
    🔗 Chilli Cream / Hot Chocolate Site: chillicream.com/
    ⏲️ Time Codes ⏲️
    PART 1 - INTRODUCTION
    0:48 Welcome
    2:38 Demo
    11:10 Course Overview
    14:03 Architecture
    17:15 Ingredients
    PART 2 - THEORY
    19:26 What is GraphQL?
    20:17 GraphQL Core Concepts
    24:22 REST Vs GraphQL
    31:22 GraphQL Frameworks in .NET
    PART 3 - CODING PART 1
    33:42 Environment Setup
    38:44 Project Setup
    47:58 Setup SQL Server with Docker
    58:29 Configuration & Dependency Injection
    1:10:41 Set up our 1st Model
    1:14:20 Setup DB Context & Connection String
    1:25:44 Migrate to DB
    1:32:45 Create GraphQL Query
    1:37:33 Configuring GraphQL Services (Startup Class)
    1:38:54 Configuring GraphQL in Request Pipeline ()
    1:40:03 Querying our endpoint with Banana Cake Pop & Insomnia
    1:51:39 Setting up and using GraphQL Voyager
    1:57:55 Concurrent quering issue
    2:02:10 Introducing the Pooled DbContext Factory
    PART 4 - CODING PART 2 - EXTENDING OUR QUERIES
    2:06:49 Adding our 2nd Model
    2:10:51 Update DBContext & Migrate
    2:17:41 Querying with multi-model - using projection
    2:24:40 Adding a Commands Query
    2:28:44 Adding in-line documentation to our API
    2:32:46 Annotation Vs Code First approaches
    2:38:51 Adding a Platform Type with Resolver
    2:51:08 Adding a Command Type with Resolver
    3:00:11 Sorting & Filtering capabilities
    PART 5 - CODING PART 3 - MUTATIONS & SUBSCRIPTIONS
    3:07:05 Introducing Mutations & Adding Platforms
    3:17:16 Testing our Platform Mutation
    3:22:37 Adding a Commands Mutation
    3:30:46 Testing our Commands Mutation
    3:34:08 Adding Subscriptions (Real-time events)
    3:43:01 Testing our Subscription
    PART 6 - WRAP UP
    3:45:23 Wrap up and Final thoughts
    3:46:48 Patreon Supporter Credits

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

  • @rc2893
    @rc2893 3 года назад +18

    I was getting errors using the ResolveWith in the two Type classes, what fixed the issue was adding the [Parent] decorator to the first argument in the two Resolvers classes.
    public Platform GetPlatform([Parent] Command command, [ScopedService] AppDbContext context) and
    public IQueryable GetCommands([Parent] Platform platform, [ScopedService] AppDbContext context)
    Hope this helps anyone doing this currently.
    This is with HotChocolate version 12.0.1

    • @mps4856
      @mps4856 2 года назад

      Got the same, thanks !

    • @ANTONZUBAREV
      @ANTONZUBAREV 2 года назад

      and I

    • @유광수-v1q
      @유광수-v1q 2 года назад

      I spent two days, and no result. But, THANK YOU ^^

    • @sameergsr
      @sameergsr 2 года назад

      Thanks! you saved a lot of my efforts. I got stuck with these errors

    • @ProgrAmadaMente
      @ProgrAmadaMente 2 года назад

      Thank you so much!

  • @81NARY
    @81NARY 3 года назад +75

    Tip: If you add a 00:00 time code in your description, then youtube will automatically add chapters to the video.

  • @dzsukov
    @dzsukov 3 года назад +21

    Amazing tutorial, thank you! What would be awesome is to include a section (or a separate video) on how to handle authorization in GraphQL (both "endpoint-wide" and also user by user/object by object). I know it's a whole different complex can of worms and lots of work, however that's the last piece of info for me to be able to "ditch" REST :) Any chance you would be up to something like that?

  • @HaoNguyen-km9xj
    @HaoNguyen-km9xj 3 года назад +1

    Make more and more video about API and GraphQL please... It's very useful,... very useful....

  • @code3658
    @code3658 3 года назад +6

    Nice tutorial. I learned a lot. Please create a video about authentication and authorization stuff with GraphQL.

  • @v0fbu1vm
    @v0fbu1vm 2 года назад

    I really loved the content here. It was easy to understand and just straight forward. Could you please, go into how to secure a GraphQL Api. I have tried a lot of ways but just cannot get my head around it. Sincerely.

  • @saikatray5792
    @saikatray5792 3 года назад

    It is very hard to find tutorials that strikes the perfect balance between concepts and hands on and this tutorial does exactly that. Also i was determined to try out Postman throughout the session but seeing how Insomnia tool supports GraphQL, i do not see myself using postman for graphql executions. Thanks @LesJackson

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

    For someone who is doing this app in dotnet 7 and has errors after creating the PlatformType, you need to put the [Parent[ attribute in front of the GetCommands method from the Resolvers class.
    This is a breaking change in the framework of HotChocolate

  • @tisurmaster
    @tisurmaster 3 года назад +7

    could you use ODATA and keep HTTP API instead of using graphQL?

  • @georgcordes5909
    @georgcordes5909 3 года назад

    Hi Les! Love your voice, your beart, the accent and the way you're teaching us all that interesting stuff! Keep up your good work! For me it is "learning with a smile" and makes it easier then elsewhere! Greetings from Hamburg to Melbourne!

  • @systemerror1405
    @systemerror1405 2 года назад +4

    If you are having trouble with resolvers not working, you must add [Parrent] atribute to the object you are passing into function.

  • @AndresZumelzu
    @AndresZumelzu 3 года назад +11

    Hi Les, thanks for this great course! I didn't finish it yet, I'm on my way :). I would like to mention one thing I found when running a profiler for sql server: when using ObjectTypes (for Platform and Commands) and doing the heavy lifting manually, there are three queries executed against the database (one per platform id). But if I use the default behavior, there is only one. I think that's worth noting. Thanks!!

  • @wilfredoguardado2712
    @wilfredoguardado2712 3 года назад

    Thanks for taking your time to make up learning in a easy way!
    Definitely I recommend this video!

  • @chamir4614
    @chamir4614 3 года назад +5

    Hi, is there a way to add authentication and authorization to this project?

  • @bujin1977
    @bujin1977 3 года назад +11

    Oof! I'm interested in GraphQL and may look at implementing it into one of my future projects. Might have to digest this video in chunks though! :D

    • @bujin1977
      @bujin1977 3 года назад +2

      Finally got through it. Very interesting, and very well explained.

  • @syeddaniyalhaider2547
    @syeddaniyalhaider2547 3 года назад +4

    Very nice in case GraphQL.Server.Ui.Voyager Version="5.0.2" is installed Configure section of Startup file will be as
    app.UseGraphQLVoyager(new VoyagerOptions() {
    GraphQLEndPoint = "/graphql" },
    path: "/graphql-voyager"
    );

  • @OctarineFoundry
    @OctarineFoundry 2 года назад +8

    Just a quick FYI, I was tripped up a little by the section on ObjectTypes as the resolvers have changed a little going from v11 => v12. The fix was really simple and it was to add [Parent] to the first parameter on the resolver Get methods (GetCommands and GetPlatform).

  • @rabinbyanjankar1310
    @rabinbyanjankar1310 3 года назад +9

    This is really great presentation. Would be great if you could include the pagination support as well.

  • @KebbieG
    @KebbieG 3 года назад +1

    The GraphQLVoyagerOptions to VoyagerOptions class has changed and there is no longer a Path property.

  • @neilgilroy1629
    @neilgilroy1629 2 года назад

    Thanks so much for this great video. Merry Christmas!

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

    Les, this is indeed the best video on this library, but since HotChocolate has reached v13, and they've evolved their API.... Any chance you can make a v2 of this course . Even a paid course would be awesome as training on this is fragmented :-(

  • @PlayRiteProductions
    @PlayRiteProductions 3 года назад +6

    Welcome back bro! Keep up the awesome content! You're a great teacher.

  • @darenbaker4569
    @darenbaker4569 3 года назад +2

    I love graphql but having done work with graphql.net hot chocolate is far better and I did a demo with a legacy app and got up and running in a day I love banana cake pop as the testing and info ui. Its definitely something I will be promoting. Thank you for your videos it helps so much

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

    2020 was Covid on peak throughout the world. I don't know how it was good for you and/or everyone.

  • @fieryscorpion
    @fieryscorpion 3 года назад +17

    For someone struggling with the voyager setup, this is how it worked for my version of 5.0.2:
    app.UseGraphQLVoyager(new VoyagerOptions()
    {
    GraphQLEndPoint = "/graphql",
    }, "/graphql-voyager");

    • @Mattzard
      @Mattzard 3 года назад +2

      Thanks for this - the "Path" property also doesn't exist, it seems to be set as default to this:
      - localhost:5000/ui/voyager

    • @henryuta
      @henryuta 3 года назад +1

      THANKS! I burned an hour on this and could not move on.

    • @naufilshaikh09
      @naufilshaikh09 3 года назад

      Thanks

    • @Brickscrap
      @Brickscrap 2 года назад +1

      Thank you for this!

    • @Merilix2
      @Merilix2 2 года назад

      I guess the now supposed way is:
      after
      endpoints.MapGraphQL();
      insert
      endpoints.MapGraphQLVoyager("/graphql-voyager");

  • @dyakobaram
    @dyakobaram 3 года назад +4

    do you have any plan on using dapper on your next project?

  • @hirisraharjo
    @hirisraharjo 3 года назад +4

    Just finished reading a book yesterday about creating REST API in .Net core, and now youtube algorithm bring me to the author himself.
    conclusion: this guy is a superb teacher!

    • @robertmrobo8954
      @robertmrobo8954 3 года назад

      What's the name of the book brother..?

    • @karkli1874
      @karkli1874 3 года назад

      @@robertmrobo8954 It's linked in the description: The Complete ASP.NET Core 3 API Tutorial

  • @RickTheClipper
    @RickTheClipper 3 года назад +3

    A very clear and understandable tutorial could be improved by setting chapters in the video or split into pieces of about 45 minutes. This would make it far easier to find a position for recapitulation, but all in all thumbs up

  • @ankurmittal9734
    @ankurmittal9734 3 года назад +3

    Was missing you and your awesome way of teaching.. hope will get many more this year..

  • @pashavarava186
    @pashavarava186 2 года назад +1

    There was no argument with the name `command` found on the field `platform`:
    if you have this error, try to use tag [Parent] before Platform and Command entity in Resolvers Methods. Works for me.
    Here is an example:
    private class Resolvers
    {
    public Platform GetPlatform([Parent] Command command, [ScopedService] AppDbContext context)
    {
    return context.Platforms.FirstOrDefault(p => p.IdPlatform == command.PlatformId);
    }
    }

  • @volodymyryavtukhov2809
    @volodymyryavtukhov2809 3 года назад +3

    Hey Les, thanks for the great presentation. ODATA protocol seems to solve both under-fed and over-fed problems. In addition it allows you to add filters and/or range conditions. What's the benefit of using GraphQL, reinventing the query language once again. Thanks

    • @JeetKhinde
      @JeetKhinde 3 года назад +2

      Google "why odata is not popular", you will get your answers.

  • @vincentverweij1053
    @vincentverweij1053 3 года назад +2

    Hi Les, first of all would like to thank you for this great video! I have been following along almost until the end. At 02:26:40, I noticed when adding the [UseProjection] attribute, my query for Commands does not give back any platforms. It is only when I remove the attribute that I receive some platforms as a child node in my GetCommand query. Any idea why this happens? Just created the project back yesterday, so in terms of versions there shouldn't be too much of a difference. Thanks again!
    EDIT: At 02:57:55 I noticed you had the same issue (I didn't do any intermediate testing, so noticed it quite late), and you solved it the way I found out :-D

  • @abdullahquhtani4247
    @abdullahquhtani4247 3 года назад

    Great except for two things:
    1- I think there should be kind of writing comments. Beginners need that to fully understand the code.
    2- I hope you could explain how to upload the project on a working website and how does that process done through VS-Code

  • @martinnjoroge9789
    @martinnjoroge9789 3 года назад +1

    Thanks for the tutorial. Watched and implemented to the end. Everything worked fine. Thanks once again @Les Jackson

  • @deepakkumar-cl6hs
    @deepakkumar-cl6hs 2 года назад +1

    This is Superb Tutorial, Well presented . Les hat off to your effort and passion in teaching every bit of details in such a structure and easy format. I loved this video and have become fan of your channel.
    Keep up the good work .
    Many thanks

  • @apkingboy
    @apkingboy 3 года назад +1

    Hey man on 3:06:00 I notice we still can access the licenseKey in order to query. In fact it is not available as property of the platfom object but it appears as a order

  • @amol_
    @amol_ 2 года назад

    Hey, I am new to dotnet and wondering what is best way to store connection string and how to provide connection string on prod?.
    Usually in Java(Spring boot) we override local connection string with environment variable on prod. So is there anything in dotnet?
    Don't want to use user-secret and other third party service.

  • @andrewobrian441
    @andrewobrian441 3 года назад +2

    What a mad lad! Thank you so much for these great videos, learning with you is so much easier 😊 👍👍

  • @kalabresa4329
    @kalabresa4329 3 года назад +2

    Tip: If you run "dotnet watch run", then you program you auto restart when watch some changes

  • @xtramagi
    @xtramagi 2 года назад +1

    Hi @Les Jackson very awesome and helpful tutorial, i wanted to present graphql infront of students where i work and i saw the presentation that you use in this tutorial is very clear and informative, if you could send me the presentation that would mean the world to me, thanks a bunch

  • @NilsMoller
    @NilsMoller 2 года назад +2

    This tutorial is still amazing, but you're missing one very important step: the n+1 problem. This is a huge issue that every API has to deal with, and it's not as straight forward as it should be. It would be great to see an implementation for that.

    • @tayyabbhatti6781
      @tayyabbhatti6781 2 года назад

      agreed

    • @bfosterETV
      @bfosterETV 2 года назад

      From some minimal SQL profiling, I was not seeing the n+1 surface in queries generated by this framework. Querying across a FK relationship was handled by a Join as expected, not multiple DB round trips. It seems that Hot Chocolate has a DataLoader implementation to handle the n+1 problem, but I'm not sure we wired it up in this tutorial. It's possible that Entity Framework was handling that optimization for us.

  • @piotrkowalski1564
    @piotrkowalski1564 2 года назад

    Great tutorial, thanks!

  • @Mattzard
    @Mattzard 3 года назад +1

    I have just completed this video and can confirm this was such a great introduction to GraphQL, thank you so much! I agree with another commenter that another video on the advised or suggested ways to query this new API from a frontend perspective would be great too. Thanks again!

  • @rblew131
    @rblew131 3 года назад +1

    How challenging would it be to add an authentication layer on top of this? I'm not finding a ton of examples of using GraphQL with auth.

  • @pedrorenegonzalez
    @pedrorenegonzalez 3 года назад +2

    hi, i have and error There was no argument with the name `platform` found on the field `commands`. my query is: query{
    platform
    {
    id
    name
    commands
    {
    id
    commandLine
    }
    }
    }

    • @mdshoaibahmed9290
      @mdshoaibahmed9290 3 года назад

      Yes, I also got this error

    • @lukasnguyen5496
      @lukasnguyen5496 3 года назад +5

      Hi Pedro,
      Yes, I just faced the same issue even I understood that we were doing same thing in the video. The reason is because we're using the latest version of hotchocolate which can be 12.0.1 which had some changes in the library (major version has been increased so breaking changes can be occured, it's normal).
      You can reproduce it if you go back to the version of 11.0.8, it should work well as what author has done.
      However, I believed that the stuff to go back to the version which the author demonstrated in this video is not what we're looking for, right?
      Oke, actually I have checked the library once with the latest version. And I realized that in the resolver, we have to decorate the parent object with Parent Attribute, otherwise it won't understand thing as well.
      So this is the fixes, you see, I decorated command parameter with parent attribute. Then you can run the source code once and see it's working now. You can do the same thing for PlatformType, it should be working properly also.
      private class Resolvers
      {
      public Platform GetPlatform([Parent] Command command, [ScopedService] AppDbContext context)
      {
      return context.Platforms.FirstOrDefault(x => x.Id == command.PlatformId);
      }
      }
      Hope this comment can help you anyways.

    • @pedrorenegonzalez
      @pedrorenegonzalez 3 года назад

      Thx Lucas

  • @АртёмАртём-ю4ы
    @АртёмАртём-ю4ы 3 года назад +2

    Thank you from Russia, with love

  • @oswaldumeh
    @oswaldumeh 3 года назад +2

    This is the best GraphQL tutorial yet I have watched online. Very detailed with well-explained concepts. Thanks for this awesome work!

  • @Caldaron
    @Caldaron 3 года назад

    Les!, you know you can hide cortana and the taskbar searchfield, right?^^

  • @mechaahcem1657
    @mechaahcem1657 3 года назад

    Thank you so much for your videos.

  • @hackx3353
    @hackx3353 3 года назад +2

    What about N+1 problem?

  • @artrichardson4171
    @artrichardson4171 2 года назад

    For anyone following this tutorial, here are the powershell commands in case you don't want to type them out:
    dotnet new web -n $ProjectName
    dotnet add package HotChocolate.AspNetCore
    dotnet add package HotChocolate.Data.Entityframework
    dotnet add package Microsoft.EntityframeworkCore.Design
    dotnet add package Microsoft.EntityframeworkCore.SQLServer
    dotnet add package GraphQL.Server.Ui.Voyager

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

    Tip: If you having trouble installing Core design Framework, use the below command.
    Error Message: error: NU1202: Package Microsoft.EntityFrameworkCore.Design 6.0.10 is not compatible with net5.0 (.NETCoreApp,Version=v5.0). Package Microsoft.EntityFrameworkCore.Design 6.0.10 supports: net6.0 (.NETCoreApp,Version=v6.0)
    dotnet add package Microsoft.EntityframeworkCore.Design --version 5.0

  • @strikeLikeaBee
    @strikeLikeaBee 2 года назад

    Problem: Unfortunately I'm getting errors using the Insomnia commands "Get Commands" and "Get Platforms and Commands", while using my own project or analog your GitHib project, I just downloaded and I just can't find a clue...could you help? Could you also update the project regarding the aspect nullable references (C# 8) and from your perspective the best approach?
    {
    "errors": [
    {
    "message": "There was no argument with the name `command` found on the field `platform`.",
    "locations": [
    {
    "line": 6,
    "column": 3
    }
    ],
    "path": [
    "command",
    4,
    "platform"
    ],
    "extensions": {
    "fieldName": "platform",
    "argumentName": "command"
    }

  • @lambo1707
    @lambo1707 3 года назад +6

    dev from philippines, your content helps me a lot

  • @tedrobinson9931
    @tedrobinson9931 3 года назад

    I've noticed that the new Version of GraphQL.Server.Ui.Voyager greater Than 4.4.1 isn't working GraphQL.Server.Ui.Voyager Path is failing, I've tried 5.0.(0,1, and 2)

  • @GiorgiGvimradze1
    @GiorgiGvimradze1 3 года назад

    ! important update to version 5.0.2+ of GraphQLVoyager (1:54:39) instead of :
    app.UseGraphQLVoyager(new GraphQLVoyagerOptions()
    {
    GraphQLEndPoint = "/graphql",
    Path = "/graphql-voyager"
    });
    try to use:
    app.UseGraphQLVoyager(new VoyagerOptions()
    {
    GraphQLEndPoint = "/graphql"
    }, "/graphql-voyager");

  • @jlom122
    @jlom122 3 года назад

    hmm this could end up being one of those topics like; what's better react vs angular ;-)
    Always be careful when you have to use tools with weird names. Hey mister major corporation CIO, we are going to implement your multi million dollar project using "hot chocolate", with our tests using cucumber Documentation with gherkin syntax. I've been burnt one to many times using the new flashy "frameworks" especially if its cross vendor. i.e. Google and Microsoft. it you are delivering projects on the Microsoft stack; i think it will be very difficult to recommend anything other than Rest + Odata + Utility APIs for edge cases (i.e solves complex queries for over and under fetching, and you can use basic query language like LINQ)
    But still very interesting, thanks for sharing ;-)

  • @divv8079
    @divv8079 3 года назад

    enum System.Data.CommandType

  • @OvRaf
    @OvRaf 2 года назад

    hi Les,
    I tried to combine your tutorials: run graphql in docker and get data from mssql server from another container throw the http get request.
    I deployed graphql project and mssql server using docker-compose.
    Separately both containers become available and I can fetch data from mssql container via mssql manager.
    But I fail when try to execute some GET method from graphql project from Banana Cake Pop
    What am I missing?

  • @vladimirv.443
    @vladimirv.443 2 года назад

    Great tutorial. GraphQl is cool!
    But I found it inconvenient to use GraphQl
    I can't require all fields like "select * from" in sql and I need to write all fields (from 10-100 in different request).
    How to work with dynamic entities? any advice, thanks!

  • @homeofcreation
    @homeofcreation 2 года назад

    Excellent video had to google a breaking change in the HotChocolate 12 update in the Platform and CommandsTypes code, but this is a minor issue. I have implemented Dataloaders which I definitely recommend. Great Job! Thanks!!

  • @namanvohra8262
    @namanvohra8262 2 года назад +2

    There is no doubt that this is the best tutorial out there. Thank you so much Les for also taking the time to explain the things clearly. You just gained a new subscriber.

  • @MichaelPeto
    @MichaelPeto 3 года назад +3

    This has to be one of the best tutorials I have ever watched. Thanks for putting it together!

  • @archanjoshi682
    @archanjoshi682 2 года назад

    Can you please upload the Startup.cs file somewhere and post a link of the file in the description? .NET5 is discontinued and for some reason the "dotnet new" command in .NET6 did not generate the Startup.cs file, so I had to make one manually. But in the video so far, the file is not fully visible.

  • @ryanjennings83
    @ryanjennings83 2 года назад

    When ignoring the license field I noticed that whilst it may omit it from the fields returned in the graph query, EF is still fetching the field from the DB. This doesn't happen when using UseProjection - only the fields specified will be selected from the DB. Is there a way to do this when using query types with custom resolvers?

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

    I have not experience as much as you have as software developer but I have suggestion for you, title of the video is GraphQL API with .NET that's why if someone come here they need to know .NET and the rest that's why you don't need to dive into detail of every single component of the journey of the project. and you can make video for them seperately and you can add them in this video's cards section.

  • @АндрійРижков-х8й
    @АндрійРижков-х8й 2 года назад

    Amazing. Thank you.
    Can somebody help me?
    How to add opportunity to get object by id, using:
    query{
    object(id: 5){
    name
    }
    }

  • @qaximmalik
    @qaximmalik 2 года назад

    Hi Les Jackson,
    Your tutorial is very good but I have a question. When configuring the voyager in the request pipeline, I am not able to find Path as a parameter to specify the path of the voyager. Can you please help me with that?

  • @vheckthordrey13
    @vheckthordrey13 2 года назад

    When I Added the type classes in HotChocolate.AspNetCore version 12.7.0, a lot of errors were returned that I can't resolve, can you do an updated version of this?

  • @orochinagi1111
    @orochinagi1111 2 года назад

    thanks Les!!!!!!!!!! im subbed to your Patreon now :) next stop: microservices course! keep em comin baby

  • @piotrekkwiatkowski5122
    @piotrekkwiatkowski5122 2 года назад

    I have a question. Does it make sense to declare relationship two times? First - "one platform has many commands with one platform". Secound - "one command has one platform with many commands".
    Is there any reason why u are typing it twice?

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

    Does it form a single join query or do N+1 queries when doing the projection? If it does not do it in one single database query, I would not use it. Years ago, when learning how to implement graphql, I was seeing in the tutorials that there was no infrastructure to turn projections into a single join query, so I avoided using it and built my own alternative to graphql, that works similarly but creates efficient queries, using a rest api and query string parameters to inform the tree of objects and fields to fetch and give extra query filtering and sorting parameters. The mutations part of grapql does not offer much extras anyway, can be handled easily in rest api using put or patch http requests.

  • @maziyar.m
    @maziyar.m 2 года назад

    The video was great. But how to use graphql in any architecture like clean. Graphql working with entities directly but we need tp hide entities in the infrastructure and use domain models in our layers. How you solving this problem?

  • @joaofranco6779
    @joaofranco6779 3 года назад +2

    Very easy to understand, great voice, great visuals and great pace! Overall, a very good tutorial that is easy to digest and very much worthwhile going through. I only had one slight issue when I couldn't get Voyager to work, other than that every part was flawlessly explained and shown!

    • @toddnedd2138
      @toddnedd2138 3 года назад +4

      if you are using package GraphQL.Server.Ui.Voyager Version="5.0.1" or higher the following should help:
      using GraphQL.Server.Ui.Voyager;
      public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
      {
      ...
      app.UseGraphQLVoyager(new VoyagerOptions(){
      GraphQLEndPoint = "/graphql"
      });
      }
      default voyager endpoint is "ui/voyager"
      cheers.

    • @rafaelskiba3854
      @rafaelskiba3854 3 года назад +4

      @@toddnedd2138 This does not work for me.
      But this:
      app.UseGraphQLVoyager(new VoyagerOptions(), "/graphql-voyager");
      You can also omit the path. Then the GraphQL Voyager is accessible via its default: /ui/voyager

    • @fieryscorpion
      @fieryscorpion 3 года назад +1

      @@rafaelskiba3854 I was googling the hell out of it and still unable to figure it out. Thank you so so much!

  • @florinpilca936
    @florinpilca936 3 года назад

    The resolver doesn't seem to be hit. At minute 2:48:20 at line 29 in class PlatformType, if you comment out the line everything works just the same. Am I missing something?

  • @muratasarslan2359
    @muratasarslan2359 3 года назад

    Hey Les, how about an upgrade to latest version and adding subscription using redis pupsup?

  • @sodreigor
    @sodreigor 2 года назад

    I understand this is a matter of personal preference, but watching you typing so many things that Visual Studio or Rider would type for you automatically, tics my nerves for some reason hahahaha.

  • @DaveHounddog
    @DaveHounddog 5 месяцев назад

    Hi Les, F$k me.. what a great walk through. Did not follow everything the first time through but was fantastic to see practical end-end and to get an appreciation of the hill to climb with this tech.. but at same time certainly got to appreciate what it is offering!

  • @andremens8420
    @andremens8420 2 года назад

    HI Les i've looked the video from start to finish and a few part again. I've one question wich is about the Resolvers around 2:50. If i implement the resolver patern then i see a EF call for every record. When i don't use the resolver the EF only needs one call for the complete result. Is there i do wrong or is this by design and what is the profit of the resolver patern.

  • @davewasthere
    @davewasthere 3 года назад +1

    These are such high quality videos, I love it!

  • @arunnaveenkumar
    @arunnaveenkumar 3 года назад +1

    Thanks for Tutorial. Love way of your teaching 👍

  • @arielcabrera2584
    @arielcabrera2584 2 года назад

    Thanks for the tutorial, I got an error using types, when I run Platform is ok, but when add the Commands property an error shows up, can someone help please

  • @sarinasalim2494
    @sarinasalim2494 2 года назад +1

    One of the best tutorials I’ve seen. Coming from zero knowledge of graphql I feel at least now I understand the concepts backed by hands on examples. Thank you. Count me in as a new subscriber.

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

    Can someone convert this into .net6. I couldn't follow this tutorial properly because doing it while converting the code into .net 6 is confusing for me lol

  • @karinn7163
    @karinn7163 2 года назад +1

    Amazing tutorial, very clear, thank you

  • @KebbieG
    @KebbieG 3 года назад

    I wished you would have showed what the proper way with a graphQL how to return a error. In the methods you should be doing data validation checks to make sure the data is valid before inserting. Would you just return null? I am not sure if it will inform the caller that the data wasn't valid.

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

    I love his tutorial! His teaching mannerism is so assuring and easy to follow. Best instructor ever!

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

    Is pooling dbContextes means creating multiple connections to db for single request or it means just query to db multiple time ?

  • @baoshenyi
    @baoshenyi 3 года назад +1

    Great video. thank you!
    I count an issue with foreign key using command query
    Command table records:
    6 HowTo RedHat1 CommandLine6 6
    7 HowTo RedHat2 CommandLine7 6
    Query:
    query{
    command(where: {platformId: {eq:6}}){
    id
    howTo
    platform{
    id
    name
    }
    }
    }
    Result: platform is null all the time, the reasons is that platform.Id is "0" all the time.
    return context.Commands.Where(p => p.PlatformId == platform.Id);
    Any ideas? thanks again!

  •  3 года назад +2

    I just want to say: This is awesome!!!

  • @Gojam12
    @Gojam12 2 года назад

    I noticed you install GraphQL as the server, I thought that was the purpose of HotChocolate to act as the server?

  • @OctarineFoundry
    @OctarineFoundry 2 года назад +1

    A lot of tutorials on tech topics fly over the "obvious stuff". I really appreciate that you take the time to go into the details of each step but remain concise. Great video thanks.

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

    you didnt showed on how to wrap graphql on existing restapi @Les Jackson

  • @pedrorenegonzalez
    @pedrorenegonzalez 3 года назад

    Hi, great, i migratting my system .net core api and mvc using this technology, Thx

  • @thespicycoder5583
    @thespicycoder5583 3 года назад

    Excellent tutorial. Very clear on every setp & easy to follow along.
    Can we please expect a video on integration testing GraphQL?
    With Web API, it is easy to perform in-memory API testing
    Any such option works with GraphQL?

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

    public IQueryable GetCommands([Parent]Platform platform, [ScopedService] AppDbContext context) in resolver for the error

  • @eliassal1
    @eliassal1 3 года назад +1

    Great, wondeful, easy to absorb and understand topic. I love your method of training others. I think it would be great if you show at the end for 10 minutes how to call all those GraphQl services (Platform, Command) from a .Net client or an asp.net mvc web page, that would be great if you can add this part, well done and thanks for making this available for the community.

    • @KittFanNr1
      @KittFanNr1 3 года назад

      Yes, that would be great. I was also thinking about the graphql response, its very dynamic - How would you deal with this in a .net application?

    • @eliassal1
      @eliassal1 3 года назад +1

      @@KittFanNr1 I googled but was not able to figure it out for this code, they were all specific and not similar to what Les showed us, maybe he can help us with a 15 minutes video if he has some availability :-)

  • @turalaliyev1764
    @turalaliyev1764 2 года назад

    is it good to use GraphQL in Chat by signalR ? Notice that i am gonna bind that chat to a microservice

  • @amitsamanta8440
    @amitsamanta8440 3 года назад

    Nice Presentation. One correction, I would like to add one point hare, the GraphQL.Server.Ui.Voyager.VoyagerOptions seems have a changed syntax in latest version as follows
    app.UseGraphQLVoyager(new VoyagerOptions()
    {
    GraphQLEndPoint = "/graphql",
    }, "/graphql-voyager");

  • @XirTiK
    @XirTiK 2 года назад

    "I'll put a link to videos managing secrets"
    no links in sight :'(