当我尝试运行我的程序时,我收到以下错误"非静态方法需要一个目标"在这段代码上:
:admin namespace
经过进一步调查后,我发现错误发生在代码的这一部分:
public IEnumerable<Ticket> ReadTicketsForReleases(
Release fromRelease = null,
Release toRelease = null,
int? companyId = null,
bool includeFlaggedForEveryCompany = false,
TicketState[] states = null)
{
return ctx.Tickets
.Where(t => companyId == null ||
(includeFlaggedForEveryCompany && t.InReleaseReportEveryCompany) ||
(t.CreatedForUser.Company != null && t.CreatedForUser.Company.CompanyId == companyId))
.Where(t => states.Any(s => t.State == s))
.Where(t => (fromRelease == null && toRelease == null) ||
((t.Release != null) &&
(t.Release.ReleaseDate >= (fromRelease == null ? DateTime.MinValue : fromRelease.ReleaseDate)) &&
(t.Release.ReleaseDate <= (toRelease == null ? DateTime.MaxValue : toRelease.ReleaseDate))))
.ToList();
}
我几个小时后就研究过这个问题并尝试了我能找到的所有解决方案,但似乎没有任何效果。如果有人能告诉我我做错了什么,你会得到我永恒的感激之情。