(în curs de editare)

CREATE PROCEDURE [dbo].[GetCustomers]
AS
    SELECT 
    [ci].[CustomerID] AS [CustomerID], 
    [c].[Title] AS [Title], 
    [c].[FirstName] AS [FirstName], 
    [c].[MiddleName] AS [MiddleName], 
    [c].[LastName] AS [LastName], 
    [c].[Suffix] AS [Suffix], 
    [c].[CompanyName] AS [CompanyName], 
    [c].[SalesPerson] AS [SalesPerson], 
    [ci].[EmailAddress] AS [EmailAddress], 
    [ci].[Phone] AS [Phone]
    FROM  [dbo].[CustomerContactInfo] AS [ci]
    INNER JOIN [dbo].[Customer] AS [c] ON [ci].[CustomerID] = [c].[CustomerID]

PASUL 1 . La generarea entity model-ului se adaugă și procedura stocată dorită

00-2 Choose Data Objects.jpg

PASUL 2. În panoul Entity Model se invocă meniul "Create Funtion Import"

01 Model Broser Panel.jpg

PASUL 3. Se crează "funcția" importată

02-1 Funtion Import.jpg

 

01-1 Model Broser Panel.jpg

PASUL 4. Se folosește "funcția" în DAL

Se modifică linia 14 din

return aw.Customers.ToList();

după cum urmează:

return aw.GetCustomers().ToList();

PASUL 5. Verificare în SQL Profiler

SQL Profiler Trace SP.jpg

 

exec [dbo].[GetCustomers]

ADO.NET EF - Tutorial 03.zip (102,06 KB)
 
All comments require the approval of the site owner before being displayed.
Name
E-mail
(will show your gravatar icon)
Home page

Comment (Some html is allowed: a@href@title, b, blockquote@cite, em, i, strike, strong, sub, sup, u) where the @ means "attribute." For example, you can use <a href="" title=""> or <blockquote cite="Scott">.  

Enter the code shown (prevents robots):

Live Comment Preview