开发者

Avoiding Linq real database operations

If I implement this interface:

public int开发者_JAVA百科erface IProductsRepository
{
    IQueryable<Product> Products { get; }
}

... using Linq to SQL

Will this produce real database queries?

var x = from p in repositoryInstance.Products where price > 100;

If so how can I avoid callers from executing complex and slow sql statements?


LINQ to SQL (and other LINQ providers) will not allow invalid SQL statements. If possible, a compile-time error will prevent the code from compiling. If that's not possible, an error will be thrown at runtime.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜