开发者

How to disable lazyload in subsonic programmatically?

开发者 https://www.devze.com 2022-12-17 13:57 出处:网络
By d开发者_C百科efault if the table has FK, subsonic also retrieves data of the FK table. Is it possible to disable this?If you ask for rows of data from a particular table, SubSonic will only give yo

By d开发者_C百科efault if the table has FK, subsonic also retrieves data of the FK table. Is it possible to disable this?


If you ask for rows of data from a particular table, SubSonic will only give you the rows from that table, even if it has foreign keys out to other tables. e.g.

EmployeeCollection employees = new EmployeeCollection().Load();

If you want the data from a related table (via a foreign key), you would have to follow the references to the other tables, incurring the trip to the database. e.g.

foreach(Employee e in employees){
  Debug.Print(e.Department.DepartmentName);
}

where Department is the related foreign key table and DepartmentName is a column in that table.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号