我试图找到并经营一个名叫Dompiled Query的人。 我如何以姓名查阅汇编的问题,然后我如何援引代表?
这里,我可以找到——我发现错误,对目标方法具有约束力。
public class ActivityRepository
{
private readonly ActivityDataContext _db;
public ActivityRepository()
{
_db = new ActivityDataContext();
}
public static Func<ActivityDataContext, int, IQueryable<ProjectObject>>
GetCompiledLatestProjects = CompiledQuery.Compile
((ActivityDataContext db, int projectId) =>
from c in db.projectObjects
where c.projectId == projectId
select c);
public static Func<ActivityDataContext, Guid, IQueryable<Report>>
GetCompiledReports = CompiledQuery.Compile
((ActivityDataContext db, Guid itemId) =>
from c in db.Reports
where c.reportObjectId == itemId
select c);
页: 1 其他已编辑的查询,但结果是可贵的物体,可采用共同接口一项目。 目的
delegate IQueryable<IProjectObject> MyDelegate();
static MyDelegate GetByName(object target, string methodName)
{
return (MyDelegate)Delegate.CreateDelegate
(typeof(MyDelegate), target, methodName);
}
public IList<Results> GetResults(string reportName)
{
IQueryable<ProjectObject> projectItems = GetLatestProjectObjects(projectId, quantity);
foreach (projectObject o in projectItems)
{
MyDelegate del = GetByName(this, reportName);
var dbReport = (IProjectObject) GetCompiledReports(_db, o.itemId).FirstOrDefault();
// add results to List and return
}
}
}