我无法在DbContext中看到POCO类的存储过程

stu*_*zzo 3 stored-procedures entity-framework entity-framework-ctp5 asp.net-mvc-3

为什么我看不到在我的DbContext中添加的存储过程?DbContext由CTP5版本(带有POCO类)引入的模板生成.

我添加了本教程所述的存储过程:http: //thedatafarm.com/blog/data-access/checking-out-one-of-the-new-stored-procedure-features-in-ef4/

此外,我搜索了条目是否在我的上下文中添加,这些是结果:

<Function Name="GetClientsForEmailSend" Aggregate="false" BuiltIn="false" NiladicFunction="false" IsComposable="false" ParameterTypeSemantics="AllowImplicitConversion" Schema="dbo" />

<FunctionImport Name="GetClientsForEmailSend" EntitySet="Client" ReturnType="Collection(DBMailMarketingModel.Client)" />

<FunctionImportMapping FunctionImportName="GetClientsForEmailSend" FunctionName="DBMailMarketingModel.Store.GetClientsForEmailSend">
Run Code Online (Sandbox Code Playgroud)

一个类似的问题是:

为什么EF4不会生成支持我的功能导入的方法?

但我已经完成了所有的建议.

这是存储过程:

ALTER PROCEDURE GetClientsForEmailSend
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT OFF;

-- Insert statements for procedure here
SELECT *
FROM dbo.Client AS c
INNER JOIN Subscription AS i on c.IDClient = i.IDClient
WHERE c.Email is not null and c.Email <> '' and i.Active = 1
END
GO
Run Code Online (Sandbox Code Playgroud)

我错过了什么?

谢谢

Lad*_*nka 5

DbContext不支持将存储过程映射到方法.您必须使用context.Database.SqlCommand(...)或context.Database.SqlQuery(...)直接调用过程.