5 - Lazy Loading in Entity Framework

Sdílet
Vložit
  • čas přidán 7. 04. 2019
  • Lazy loading means delaying the loading of related data, until you specifically request for it.
    For lazy loading Navigation property should be defined as public and virtual. Context class will not do lazy loading if property is not defined as virtual.
    Lazy loading is default phenomenon.
    When using POCO entity types, lazy loading is achieved by creating instance of derived proxy types and then overriding virtual properties.

Komentáře • 15

  • @Uzair_Anwar2299
    @Uzair_Anwar2299 Před 4 lety +2

    U are life saver. love from Pak

  • @morsheddld
    @morsheddld Před 3 lety +2

    Superb tutorial

  • @lokarapusantosh7798
    @lokarapusantosh7798 Před 4 lety +1

    Good explanation ☺️.. simple and clear

  • @vijayakhaire8883
    @vijayakhaire8883 Před 4 lety

    Simple and Good explanation

  • @FleurOlivia
    @FleurOlivia Před 3 lety +3

    Thank you! It's nice to have a female professor, I have't had that in my four years of uni!

    • @damianclyde9250
      @damianclyde9250 Před 3 lety

      A tip: you can watch series at KaldroStream. Me and my gf have been using it for watching all kinds of movies lately.

    • @malachiraymond485
      @malachiraymond485 Před 3 lety

      @Damian Clyde Yea, I've been using flixzone} for years myself :)

    • @morganmax3132
      @morganmax3132 Před 3 lety

      @Damian Clyde Yup, been watching on Flixzone} for since november myself :)

  • @gayatrigokhale7181
    @gayatrigokhale7181 Před 4 lety

    The common property in our case 'CityId' needs to be same ? I mean if I have 'Id' in city class and 'CityId' in Area class ? Will it work ? Trying this it's not working at my side.

    • @CodeSemantic
      @CodeSemantic  Před 4 lety +1

      Did you configure the FK(Foreign Key) properly in database and then generated Entity framework classes?
      Let me know this, then only I can answer you question.

  • @WaqasMehmood-nq5uz
    @WaqasMehmood-nq5uz Před 2 měsíci

    what is POCO entity ?

  • @ahmadjaber2940
    @ahmadjaber2940 Před 4 lety +1

    Hi!
    Personally I don't like the idea of code first migration so I manualy created a script to create the database scheme and then I runned >>
    scaffold-dbcontext -provider Microsoft.EntityFrameworkCore.SqlServer -connection "My_connection"
    That created the classes I need to interact with database. Is that a good thing to do or we should use the CodeFirst way? please help

    • @morsheddld
      @morsheddld Před 3 lety

      U should use code first to have the full control on Db otherwise It's a bit difficult to manage everything. For professional project i recommend code first as i had a bad experience with db first. For example a varchar(25) column u created in your table and if u generate entity from your db the column length won’t be written in entity class and if u manually define max length data annotation in entity class Field then every time u regenerate your entity class from db in case of any updates in db to affect entity class, the total entity class will be regenerated as a result any previous annotation in class will be replaced even though u can preserve the annotation only by creating additional partial class then configure class which is not hassle free. So think for your best approach.

    • @ahmadjaber2940
      @ahmadjaber2940 Před 3 lety +1

      @@morsheddld Thanks Morshedul for the answer. I think the database model should not frequently changed. I used both approaches I found dB-first more cleaner approach for my side, I’ll think about your advice, thanks again.

  • @manpreetsrmcem
    @manpreetsrmcem Před 3 lety

    Cuckoo sound is nice from 11:37...