Deferred loading in LinqToSql
-
Hi all. Could somebody explain me why this string automatically retrieve data from db. _bindingSource.DataSource = _context.VAllClients; How could i prevent this? What i should do that neccessary data retrieved only when i requiry them directly? I mean: Every time when i link some dataSource to dataEntity this dataEntity is filled automatically. I want to control this (when data should be loaded) by myself. Thanks!
-
Hi all. Could somebody explain me why this string automatically retrieve data from db. _bindingSource.DataSource = _context.VAllClients; How could i prevent this? What i should do that neccessary data retrieved only when i requiry them directly? I mean: Every time when i link some dataSource to dataEntity this dataEntity is filled automatically. I want to control this (when data should be loaded) by myself. Thanks!
What kind of object is _bindingSource? My guess would be that it likely iterates through the data when DataSource is assigned to. You could create a var that holds the _context.VAllClients reference and only assign to _bindingSource when you're ready.