有时,您需要一个简单的验证点,但是有时您需要条件语句,还有时您需要添加一个延迟或者循环。
Sometimes, you can get by with a simple verification point, but sometimes you need conditionals, and sometimes you need to add a delay or a loop.
这就是延迟加载,即尽可能长的延迟查询语句的执行。
This is lazy loading, or deferring the query as long as possible.
在多个查询语句的执行过程中需要保持数据库连接,否则会抛出一个延迟加载异常,这将导致数据出现问题。
Database connection needs to be maintained for the duration of the multiple query cycle else a lazy loading exception is thrown, resulting in inadequate use of resources.
当创建这个查询时,SQL语句并没有被发送到数据库中,只有当你在代码中对这个IQueryable对象进行Iterate操作时,这个SQL语句才会被创建并执行,这个概念就是延迟执行。
At the moment the query is created, no SQL statement is issued to the database. The SQL statement is created and executed when your code iterates the IQueryable object.
如果对实体employee所关联的dependent和department这两个实体使用延迟加载,那么在操作2和3中就会生成更多的SQL查询语句。
If we use lazy loading feature on employee entity for dependent and department entities then in use case 2 and 3, more SQL queries are fired to fetch the required data.
如果对实体employee所关联的dependent和department这两个实体使用延迟加载,那么在操作2和3中就会生成更多的SQL查询语句。
If we use lazy loading feature on employee entity for dependent and department entities then in use case 2 and 3, more SQL queries are fired to fetch the required data.
应用推荐