无法访问另一个命名空间中的类c#

时间:2017-11-17 11:07:29

标签: c# asp.net

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班级

0 个答案:

没有答案