Entity Framework CTP5 - How to Call Stored Procedure?

You can execute database-wide sql statements like this.

You can execute database-wide sql statements like this using(var context = new MyContext()) { // custum sql statement var c = context.Database. SqlQuery("SELECT COUNT(*) FROM Employees"); // returned entity type doesn't have to be represented by ObjectSet/DBSet var e = context.Database. SqlQuery("SELECT * FROM Employees"); // stored procedure var q = context.Database.

SqlQuery("GetEmployees"); }.

Which is exactly what I put in my edit to my question. – RPM1984 Jan 25 at 22:54 1 This answers your first concern. The sp's are available context-wide.DbContext.

Database is a reference to the built-in DbDatabase object. This is different from context.People. SqlQuery which operates on the DbSet.

– Steven K. Jan 26 at 10:19 Ahh your right, will give this a go and get back to you. – RPM1984 Jan 26 at 22:46 Works great.

Thanks! – RPM1984 Jan 27 at 4:48 From my comment: "The sp's are available context-wide. ".

This should be "Database-wide" since you can query data that isn't related to the context. – Steven K. Jan 27 at 7:04.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions