开发者

I can't see stored procedures in DbContext with POCO classes

Why I can't see the stored procedure added in my DbContext? Th开发者_开发问答e DbContext is generated by the template introduced with the CTP5 release (with POCO classes).

I added the stored procedures as said by this tutorial: http://thedatafarm.com/blog/data-access/checking-out-one-of-the-new-stored-procedure-features-in-ef4/

Moreover I searched if the entry is added in my context and these are the results:

<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">

A similar question is:

Why won't EF4 generate a method to support my Function Import?

but I've done all the suggests.

This is the stored procedure:

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

What I'm missing?

Thanks


DbContext doesn't provide support for mapping stored procedures to methods. You must call procedure directly by using context.Database.SqlCommand(...) or context.Database.SqlQuery(...)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜