选择所有EF和lambda

时间:2012-07-06 16:39:07

标签: linq entity-framework lambda

我写了这个很棒的代码,我现在无法使用。

目前正在运作示例:

complete item = ReliableExecution.RetryWithExpression<complete, complete>(u => u.FirstOrDefault(x => x.str_en == segment));

,这是RetryWithExpression代码的一部分:

public static TValue RetryWithExpression<T, TValue>(Func<ObjectSet<T>, TValue> func, Int32 retryInfiniteLoopGuard = 0)
     where T : class
{
    RetryPolicy policy = RetryPolicyProvider.GetSqlAzureRetryPolicy();
    using (DDEntities dataModel = new DDEntities())
    {
        var entitySet = dataModel.CreateObjectSet<T>();

              ...

                var query = policy.ExecuteAction(() => (func(entitySet)));

              ...

现在我的问题是如何更改上面的选择查询以进行SELECT *?

我确实尝试了这个,但它告诉我有关我不理解的错误的事情:

complete item = ReliableExecution.RetryWithExpression<complete, complete>(u => u.Select(x => x.str_en != ""));

1 个答案:

答案 0 :(得分:0)

IQueryable<complete> items = ReliableExecution.RetryWithExpression<complete, IQueryable<complete>>(u => u.Where(x => x.str_en != ""));