Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Entity Framework 101
Message
De
03/06/2014 08:58:14
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Entity Framework
Titre:
Entity Framework 101
Versions des environnements
Environment:
C# 4.0
OS:
Windows 8
Network:
Windows 2000 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01601183
Message ID:
01601183
Vues:
59
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform