简体   繁体   English

EF4-获得儿童价值

[英]EF4 - Get Child Value

i'm beginning with EF4, 我从EF4开始,

In my Controller class, i have an object like this 在我的Controller类中,我有一个像这样的对象

House
   ->List<Wall>
           ->List<Windows>

Because i want to be able to cancel change, i keep this data in a object 因为我希望能够取消更改,所以我将此数据保留在一个对象中

(i use SaveChange to "commit" data) (我使用SaveChange来“提交”数据)

I would like to have a function like that :' Windows getWindowsById(Guid IdWindows) ' 我想要一个类似的功能:“ Windows getWindowsById(Guid IdWindows)

Is their any better way to get my windows without iterating with "wall" and "windows" ( foreach ... ) ? 他们有没有更好的方法来获取我的窗口而不用迭代“ wall”和“ windows”( foreach ... )?

I use CTP5 so maybe a query with the Local propertie can be a way, but i would like to know the best way 我使用CTP5,所以使用Local属性查询可能是一种方法,但是我想知道最好的方法

thanks 谢谢

如果您使用的是CTP5,我希望它可以正常工作:

context.Windows.Local.SingleOrDefault(w => w.Id == idWindow);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM