C#扩展方法中的递归lambda表达式

时间:2013-09-10 05:47:52

标签: c# entity-framework recursion lambda

请考虑以下事项:

using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Bll {
    public static class Extensions {

        public static IQueryable<Sys.EntityModels.BfxProject> CompleteProject( this Sys.EntityModels.BfxEntities context ) {
            return context.BfxProjects
                .Include( x => x.BfxFiles.Select( f => f.BfxSecurity ) );
        }
    }
}

BfxProjects可以嵌套BfxProjects。我希望CompleteProject扩展方法以递归方式返回任何嵌套的BfxProjects。我该如何做到这一点?

0 个答案:

没有答案