Как я могу создать веб-API ASP.NET с помощью Entity Framework? Я создал Db Connection с использованием Entity Framework, добавил таблицу и хранимые процедуры.
Импортирую хранимые процедуры на диаграмме .edmx
:

Модель выглядит как
namespace EmployeeInformationDatabase.Models
{
using System;
using System.ComponentModel.DataAnnotations;
public partial class spGetEmployeees_Result
{
[Key]
public int Employee_Number { get; set; }
public string first_name { get; set; }
public string last_name { get; set; }
public string User_logon_Name { get; set; }
public string Employee_Display_Name { get; set; }
public string Employee_Type { get; set; }
public Nullable<int> Active { get; set; }
public string Is_Supervisor { get; set; }
public string index_no { get; set; }
public string Noname { get; set; }
public string position { get; set; }
}
}
, а мой контроллер выглядит как
using EmployeeInformationDatabase.Models;
namespace EmployeeInformationDatabase.Controllers
{
public class spGetEmployeees_ResultController : ApiController
{
private EmployeeEntities db = new EmployeeEntities();
// GET: api/spGetEmployeees_Result
public IQueryable<spGetEmployeees_Result> GetspGetEmployeees_Result()
{
return db.spGetEmployeees_Result;
}
}
}
, но я получаю это при запуске веб-API из http://localhost:55198/api/spGetEmployeees_Result
:
