こんにちは、DBから直接データを取得して操作するために使用する前に、今回はエンティティデータモデルを使用しています。.edmx
ファイルにすべてのテーブルがあります。DBにデータを取得するためのクエリがいくつかありますが、現在はエンティティデータモデルを使用しているため、コントローラーでそのプロシージャを呼び出す方法がわかりません。ここでは、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
どうすればよいですか?