.NET 7 Update: Nullable Models in MVC in 10 Minutes or Less

Sdílet
Vložit
  • čas přidán 13. 11. 2022
  • In .NET 7, we can now have nullable page models and view models in Razor Pages and MVC. Let's see it in action in this 10-Minute Training video.
    Full Training Courses: IAmTimCorey.com
    Source Code: leadmagnets.app/?Resource=Nul...

Komentáře • 26

  • @AgerBoniard
    @AgerBoniard Před rokem +4

    Hello Tim, have you thought of making a video showing how to structure your project according to DDD? Or do you already have any courses that illustrate that? Thanks for all the tutorials, you're a huge help!

  • @bmiller949
    @bmiller949 Před rokem

    I love these 10 minute knowledge nuggets that are easy to mentally digest. Especially when you are old enough to have driven themselves to see Star Wars in the theatre. 🤣

  • @WondervilleSeries
    @WondervilleSeries Před rokem

    This feature will be helpful moving forward. Thanks for the info :)

  • @selahattinkaradogan2744

    THNX short but useful video

  • @stylem8132
    @stylem8132 Před rokem +1

    Thanks for the great content Tim! I have a question about your courses. Is it possible to get the certificate of a course from the monthly pass or do I need to buy the course itself? Also do all of your courses provide a certificate?

    • @IAmTimCorey
      @IAmTimCorey  Před rokem +2

      All of the courses provide a certificate of completion, regardless of whether you purchase them or take them through the All Access Pass.

  • @HimalayanNavigator
    @HimalayanNavigator Před rokem

    Thanks for sharing important information

  • @kandycan
    @kandycan Před rokem

    Ok. So if the list item count is 0, i can get pretty much the same results. I don't know a specific usecase for this where it would really help. I wonder if is it valid for API models?
    Like if API model is null, are all child properties nullable or what?

    • @IAmTimCorey
      @IAmTimCorey  Před rokem +4

      A list with 0 items in it isn't the same thing as a null list. One indicates there were no records. The other indicates nothing was done. For example, if I said "give me a list of all employees with the last name of Corey" and it returned an empty list (0 entries), that means there were no employees with the last name of Corey. If it returned null, it means something else (it didn't do the lookup, there was an error looking up the results, the lookup isn't complete, etc.)

  • @usmanfarooq3071
    @usmanfarooq3071 Před rokem

    Hi Tim, which keyboard do you use while recording your videos? The keys are very quiet.

    • @IAmTimCorey
      @IAmTimCorey  Před rokem

      The Logitech MX Keys: amzn.to/3hzsfac
      I personally recommend it as the best keyboard I've ever used. They are short-throw keys, which isn't for everyone, but I put MILES on my keyboard and it just keeps working. It also can connect to up to three computers via dongle or Bluetooth. I use it for both my work computer and my gaming computer as well as on my iPad. Switching between the three is a matter of clicking one button.

    • @usmanfarooq3071
      @usmanfarooq3071 Před rokem

      ​@@IAmTimCorey Logitech products are amazing. I also heard good reviews about their MX Master 3 mouse. But I use a ten-key less mechanical keyboard. It has blue switches and it's very noisy. Do you think that MX will be a good replacement for a mechanical keyboard?

    • @IAmTimCorey
      @IAmTimCorey  Před rokem +1

      I use the MX Master 3 every day as my primary mouse. As for the MX Keys being a good replacement for a mechanical keyboard, they are two different categories. If you are ok switching to a non-mechanical keyboard then yes, it is a great replacement.

    • @usmanfarooq3071
      @usmanfarooq3071 Před rokem

      @@IAmTimCorey Thanks for your replies. Much appreciated.

  • @p3r1h4ck3r
    @p3r1h4ck3r Před rokem +1

    I don't imagine I will ever use this feature. For the types of things I develop, one of my core design principles is that each page have it's own page model that contains all the ancillary data needed to build the page (for things such as dropdown lists, etc) as well as a data model that contains the data used to populate the form elements (for instance, the data for which dropdown list item is selected). I never, ever want my page model to be null. I would much rather have a page model with an ID property that has a value of null, or better 0, to indicate a fresh form/element.

    • @IAmTimCorey
      @IAmTimCorey  Před rokem

      It all depends on your circumstances. It isn't a commonly needed item, but it is useful to have in place for when you do need it.

    • @Tony-cm8lg
      @Tony-cm8lg Před rokem

      Yeah this is my approach too, every page gets its own model that bundles all of the pages data, including models for partial pages. I’m always passing something to the view,

  • @emhyrvemrais7574
    @emhyrvemrais7574 Před rokem

    Tim maybe you can do video about GRAPHQL we need this

    • @IAmTimCorey
      @IAmTimCorey  Před rokem

      Thanks for the suggestion. Please add it to the list on the suggestion site so others can vote on it as well: suggestions.iamtimcorey.com/

  • @ranielgarcia8685
    @ranielgarcia8685 Před rokem

    What's the benefits of using null instead of empty list?

    • @bootsector13
      @bootsector13 Před rokem +1

      an empty list you can get the counts while you cant do it in null

    • @IAmTimCorey
      @IAmTimCorey  Před rokem +1

      Null and empty are different concepts. Empty means no records (select * from people where lastName = Corey and it returns 0 records). Null means one of many things in this scenario - the query was not run, the query failed, the results haven't been returned yet (a common one), etc.