Calling Entity Framework function import from code

Posted by Mikey Cee on Stack Overflow See other posts from Stack Overflow or by Mikey Cee
Published on 2010-03-09T02:48:18Z Indexed on 2010/03/09 2:51 UTC
Read the original article Hit count: 610

Filed under:

So I have a stored procedure called Spr_EventLogCreate defined in my database. I have created a function import in my data model called LogEvent with no return type, and I can see this function in the Model Browser tree at

MyModel.edmx > MyModel > EntityContainer > Function Imports > LogEvent.

I thought I should then be able to call the function in my code as follows:

var context = new MyModelEntities();
context.LogEvent(...);

But the LogEvent() method is not present.

I must be being really stupid here, but how do I call my imported function?

Using VS 2008 and EF 3.5.

© Stack Overflow or respective owner

Related posts about entity-framework