嗨,在我直接从我的数据库中检索和操作数据之前。但这次我使用的是实体数据模型。我的.edmx
文件中有所有表......我的数据库中有一些用于检索数据的查询,但现在因为我使用的是实体数据模型,所以我不知道如何在我的控制器中调用该过程,因为我在这里使用 MVC 3,任何人都可以告诉我如何使用我的存储过程获取数据或编写类似于我存储的 Linq 查询我的控制器中的程序
这是我的存储过程:
ALTER procedure [dbo].[ProjectReports]
(
@ProjectID int,
@ReleasePhaseID int
)
as
begin
select distinct projectName,ReleasePhase,
(Select COUNT(1) from Bugs where ProjectId=a.ProjectId and
ReleasePhaseID=a.ReleasePhaseID and
bugid in (select BugID from BugHistory where [status]='New')) as Newbugs,
(Select COUNT(1) from Bugs where ProjectId=a.ProjectId and
ReleasePhaseID=a.ReleasePhaseID and
bugid in (select BugID from BugHistory where [status]='Assigned')) as
Assignedbugs,
(Select COUNT(1) from Bugs where ProjectId=a.ProjectId and
ReleasePhaseID=a.ReleasePhaseID and
bugid in (select BugID from BugHistory where [status]='Fixed')) as Fixedbugs,
(Select COUNT(1) from Bugs where ProjectId=a.ProjectId and
ReleasePhaseID=a.ReleasePhaseID and
bugid in (select BugID from BugHistory where [status]='Re-Opened')) as
Reopenedbugs,
(Select COUNT(1) from Bugs where ProjectId=a.ProjectId and
ReleasePhaseID=a.ReleasePhaseID and
bugid in (select BugID from BugHistory where [status]='Closed')) as Closedbugs,
(Select COUNT(1) from Bugs where ProjectId=a.ProjectId and
ReleasePhaseID=a.ReleasePhaseID and
bugid in (select BugID from BugHistory where [status]='Deffered')) as Defferedbugs,
(Select COUNT(1) from Bugs where ProjectId=a.ProjectId and
ReleasePhaseID=a.ReleasePhaseID and
bugid in (select BugID from BugHistory where [status]='Not a Bug')) as NotaBug
from Bugs a
inner join Projects p on p.ProjectId=a.ProjectId
inner join ReleasePhase Rp on rp.ReleasePhaseID=a.ReleasePhaseID
where a.ProjectId=@ProjectID and a.ReleasePhaseID=@ReleasePhaseID
end
我该怎么做呢?