开发者

How to disable lazyload in subsonic programmatically?

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜