即时加载实体对象

及时加载MyModel实体下的MyParameter实体属性

1 using (FanacialDataContext context = new FanacialDataContext())
2 {
3                     DataLoadOptions loadOptions = new DataLoadOptions();
4                     loadOptions.LoadWith<MyModel>(item => item.MyParameter);
5                     context.LoadOptions = loadOptions;
6                     result = (from f in context.tablename
7                               where f.ContentId == ContentId
8                               select f).ToList();
9 }
posted @ 2012-09-18 10:04  鸿bi  阅读(154)  评论(0)    收藏  举报