显示标签为“c#”的博文。显示所有博文
显示标签为“c#”的博文。显示所有博文

2014年1月8日星期三

entity framework 4.1 - Should a Repository return IEnumerable , IQueryable or List? - Stack Overflow

up vote 3 down vote favorite
1
I'd like to make my application as flexible as possible, but not dig myself into a hole by making my Interface too specific.
What is the best object type for a repository? IEnumerable, IQueryable, or List?
The technologies I'm considering using are
  • Azure App Fabric Caching
  • Entity Framework 4.1
  • Possibly Windows Server AppFabric

c# - Returning IEnumerable vs IQueryable - Stack Overflow

up vote 186 down vote favorite
88
what is the difference between returning iqueryable vs ienumerable.
IQueryable<Customer> custs = from c in db.Customers
where c.City == "<City>"
select c;
IEnumerable<Customer> custs = from c in db.Customers
where c.City == "<City>"
select c;
Will both be deferred execution? When should one be preferred over the other?

C#中的委托和事件(续)


    C#中的委托和事件()

    引言
    如果你看过了 C#中的委托和事件 一文,我想你对委托和事件已经有了一个基本的认识。但那些远不是委托和事件的全部内容,还有很多的地方没有涉及。本文将讨论委托和事件一些更为细节的问题,包括一些大家常问到的问题,以及事件访问器、异常处理、超时处理和异步方法调用等内容。

C# 中的委托和事件

    C# 中的委托和事件

    引言
    委托 事件在 .Net Framework中的应用非常广泛,然而,较好地理解委托和事件对很多接触C#时间不长的人来说并不容易。它们就像是一道槛儿,过了这个槛的人,觉得真是太容易了,而没有过去的人每次见到委托和事件就觉得心里别(biè)得慌,混身不自在。本文中,我将通过两个范例由浅入深地讲述什么是委托、为什么要使用委托、事件的由来、.Net Framework中的委托和事件、委托和事件对Observer设计模式的意义,对它们的中间代码也做了讨论。