Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Entity Framework 101
Message
From
03/06/2014 08:58:14
 
 
To
All
General information
Forum:
ASP.NET
Category:
Entity Framework
Title:
Entity Framework 101
Environment versions
Environment:
C# 4.0
OS:
Windows 8
Network:
Windows 2000 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01601183
Message ID:
01601183
Views:
60
Hi,

I am following this online example:

http://www.asp.net/web-api/overview/creating-web-apis/using-web-api-with-entity-framework/using-web-api-with-entity-framework,-part-3

and need some clarification on how the data is actually getting pulled from the database.

Can someone explain to me what happens when a request is sent to http://localhost:portnum/api/admin

I think the call gets routed to
        // GET api/Admin
        public IEnumerable<Product> GetProducts()
        {
            return db.Products.AsEnumerable();
        }
in the AdminController.cs

And I gather that db.Products.AsEnumerable() is what actually queries the database and returns the data.

Somehow the
DbSet<Product> Products { get; set; }
defined in OrdersContext.cs gets involved here too.

My problem is that I am trying to adapt this to using an existing database of my own and can't work out how to tell it what data I want to be pulled back (I need it to call a Stored Procedure in my database).

Any help appreciated.
Frank.

Frank Cazabon
Samaan Systems Ltd.
www.samaansystems.com
Next
Reply
Map
View

Click here to load this message in the networking platform