渴望和懒惰加载 [英] Eager and Lazy loading

查看:114
本文介绍了渴望和懒惰加载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我有表A女巫与许多表格有关系,比如B,C,D

Hi all,

I have table A witch have relation to many tables , say B,C,D

在EF映射中我得到对象A与类型B,C,D的集合

in the EF mapping I get Object A with Collection of types B,C,D incide.

当我尝试从客户端插入新对象A时,我应该在之前提供对象B,C,D并使用SetLink命令。

When I'm trying to insert a new object A from the client side , I should supply objects B,C,D before and use the SetLink command.

我的问题,我必须从服务器对象B,C,D中取出由于某些creteria和保存A。

My problem , I have to fetch from the server objects B,C,D due to some creteria and the save A.

但这似乎非常昂贵每次去许多旅行到服务器,直到我可以保存对象A.

But this seems very expensive each time to make many travels to the server till I can save object A.

我的代码是这样的:

AB = client.B.Where(id => id.b_id == 1)。 ();与C和D相同的事情

A.B = client.B.Where(id=>id.b_id == 1).First(); the same thing to C and D

client.SetLink(A," B",AB);

client.SetLink(A,"B",A.B);

client.SaveChanges();

client.SaveChanges();

任何建议将此往返保存到服务器。

Any suggestion to save this roundtrips to the server.

谢谢......

推荐答案

不,不,我们不会告诉你答案,你必须付钱对于这种支持
No no we dont telll you the answer, you have to pay for this kind of support


这篇关于渴望和懒惰加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆