代码改变世界

随笔分类 -  Entity Framework

解决EF 4.0 中数据缓存机制

2014-04-12 00:11 by ARMdong, 1197 阅读, 收藏,
摘要: EF4.0默认开启缓存机制,如果想要禁用缓存机制的话,则须加上一句话:_db.CreateObjectSet().MergeOption = MergeOption.OverwriteChanges; public IQueryable LoadEntities(Func whereLambda) { try { var set = _db.CreateObjectSet(); set.MergeOption = MergeOption.OverwriteChanges; ... 阅读全文

How Can You Tell the Difference Between LINQ Methods and Query Builder Methods?

2014-01-15 08:53 by ARMdong, 153 阅读, 收藏,
摘要: LINQ's method syntax looks very similar to the query builder methods,except for one big difference:the parameters.Theparameters of a LINQ method ara lambda expressions,whereas the parameters of the query builder methods are Entity SQL string expressions.A number of methods have the same name:Whe 阅读全文