using cb_api.Models;
namespace cb_api.Controllers
{
public class DetailsController : ApiController
{
private ApplicationDbContext db = new ApplicationDbContext();
......
.....
}
}
ApplicationDbContext
是模型中的一个类;但我无法通过调用它的命名空间来访问它。
namespace cb_api.Models
{
public class ApplicationDbContext : DbContext
{
// You can add custom code to this file. Changes will not be overwritten.
//
// If you want Entity Framework to drop and regenerate your database
// automatically whenever you change your model schema, please use data migrations.
// For more information refer to the documentation:
// http://msdn.microsoft.com/en-us/data/jj591621.aspx
public ApplicationDbContext() : base("name=Context")
{
}
public System.Data.Entity.DbSet<cb_api.Models.Detail> Details { get; set; }
}
}
那个ApplicationDbContext
班级