Asp.net mvc 创建有错误的存储库?

Asp.net mvc 创建有错误的存储库?,asp.net-mvc,visual-studio-2010,asp.net-mvc-3,html,class,Asp.net Mvc,Visual Studio 2010,Asp.net Mvc 3,Html,Class,我正试图使用以下教程创建一个存储库,但我发现了以下两个错误 找不到类型或命名空间名称“IShowRepository”(是否缺少using指令或程序集引用?) 找不到元数据文件“C:\Users\Ben\Documents\Visual Studio 2010\Projects\StudentCharterGroupWebsite\StudentCharterGroupWebsite\bin\StudentCharterGroupWebsite.dll”。测试 任何帮助都将不胜感激 using

我正试图使用以下教程创建一个存储库,但我发现了以下两个错误

找不到类型或命名空间名称“IShowRepository”(是否缺少using指令或程序集引用?)

找不到元数据文件“C:\Users\Ben\Documents\Visual Studio 2010\Projects\StudentCharterGroupWebsite\StudentCharterGroupWebsite\bin\StudentCharterGroupWebsite.dll”。测试

任何帮助都将不胜感激

using System;
using System.Collections.Generic
using System.Data;
using System.Linq;
using StudentTheatreGroupWebsite.Models;

namespace StudentTheatreGroupWebsite.DAL
{
    public class ShowRepository : IShowRepository , IDisposable
    {
        private StudentTheatreContext context;

        public ShowRepository(StudentTheatreContext context)
        {
            this.context = context;
        }

        public IEnumerable<Show> GetShows()
        {
            return context.Shows.ToList();
        }

        public Show GetShowByID(int id)
        {
            return context.Shows.Find(id);
        }

        public void InsertShow(Show show)
        {
            context.Shows.Add(show);
        }

        public void DeleteShow(int ShowID)
        {
            Show show = context.Shows.Find(ShowID);
            context.Shows.Remove(Shows);
        }

        public void UpdateShow(Show show)
        {
            context.Entry(show).State = EntityState.Modified;
        }

        public void Save()
        {
            context.SaveChanges();
        }

        private bool disposed = false;

        protected virtual void Dispose(bool disposing)
        {
            if (!this.disposed)
            {
                if (disposing)
                {
                    context.Dispose();
                }
            }
            this.disposed = true;
        }

        public void Dispose()
        {
            Dispose(true);
            GC.SuppressFinalize(this);
        }
    }
}
使用系统;
使用System.Collections.Generic
使用系统数据;
使用System.Linq;

使用StudentCharterGroupWebsite.Models; 命名空间StudentCharterGroupWebsite.DAL { 公共类ShowRepository:IShowRepository,IDisposable { 私人学生戏剧文本语境; 公共ShowRepository(StudentChartereContext上下文) { this.context=上下文; } 公共IEnumerable GetShows() { 返回context.Shows.ToList(); } 公共显示GetShowByID(内部id) { 返回context.Shows.Find(id); } 公共void InsertShow(Show) { context.Shows.Add(show); } 公共void DeleteShow(int ShowID) { Show=context.Shows.Find(ShowID); context.Shows.Remove(Shows); } 公共无效更新显示(显示) { context.Entry(show.State=EntityState.Modified; } 公共作废保存() { SaveChanges(); } 私有布尔=假; 受保护的虚拟void Dispose(bool disposing) { 如果(!this.disposed) { 如果(处置) { context.Dispose(); } } 这是真的; } 公共空间处置() { 处置(真实); 总干事(本); } } }
我在编辑之前复制了您的代码:

    using System; 
    using System.Collections.Generic; 
    using System.Linq; 
    using System.Web; 
    using StudentTheatreGroupWebsite.Models; 

    namespace StudentTheatreGroupWebsite.DAL { 

    public interface IStudentRepository : IDisposable { 
       IEnumerable<Show> GetShows(); 
       Show GetShowByID(int ShowId); 
       void InsertShow(Show Show); 
       void DeleteShow(int ShowID); 
       void UpdateShow(Show Show); 
       void Save(); 
  }
 } 
使用系统;
使用System.Collections.Generic;
使用System.Linq;
使用System.Web;

使用StudentCharterGroupWebsite.Models; 命名空间StudentCharterGroupWebsite.DAL{ 公共接口IstudeEntrepository:IDisposable{ IEnumerable GetShows(); 显示GetShowByID(int ShowId); void InsertShow(Show-Show); void DeleteShow(int ShowID); 无效更新显示(显示); 作废保存(); } }

我会称之为“IShowRepository”,而不是iStudeEntrepository,不是吗?

我在编辑之前复制了您的代码:

    using System; 
    using System.Collections.Generic; 
    using System.Linq; 
    using System.Web; 
    using StudentTheatreGroupWebsite.Models; 

    namespace StudentTheatreGroupWebsite.DAL { 

    public interface IStudentRepository : IDisposable { 
       IEnumerable<Show> GetShows(); 
       Show GetShowByID(int ShowId); 
       void InsertShow(Show Show); 
       void DeleteShow(int ShowID); 
       void UpdateShow(Show Show); 
       void Save(); 
  }
 } 
使用系统;
使用System.Collections.Generic;
使用System.Linq;
使用System.Web;

使用StudentCharterGroupWebsite.Models; 命名空间StudentCharterGroupWebsite.DAL{ 公共接口IstudeEntrepository:IDisposable{ IEnumerable GetShows(); 显示GetShowByID(int ShowId); void InsertShow(Show-Show); void DeleteShow(int ShowID); 无效更新显示(显示); 作废保存(); } }

我会称之为“IShowRepository”,而不是IstudeEntrepository,不是吗?

你能用StudentTheatreGroupWebsite.Models显示IShowRepository的名称空间吗;namespace studentcharteregroupwebsite.DAL{您可以使用studentcharteregroupwebsite.Models;namespace studentcharteregroupwebsite.DAL{是的,谢谢我的错误,注意力不集中现在可以工作:)是的,谢谢我的错误,注意力不集中现在可以工作:)