“Data.Repository.UnitofWork”不实现接口成员“Data.Repository.IUnitofW
本文关键字:Repository Data 成员 IUnitofW 接口 UnitofWork 实现 | 更新日期: 2023-09-27 18:32:34
我有一个接口将另一个接口声明为属性
namespace Data.Repository
{
interface IUnitofWork : IDisposable
{
ICustomer Customer { get; }
int Complete();
}
}
我尝试在工作单元类中实现此接口
namespace Data.Repository
{
public class UnitofWork : IUnitofWork
{
private readonly NORTHWNDEntities _context;
public UnitofWork(NORTHWNDEntities context)
{
_context = context;
customer = new CustomerRepository(_context);
}
public ICustomer customer { get; private set; }
public int Complete()
{
return _context.SaveChanges();
}
public void Dispose()
{
_context.Dispose();
}
}
}
但它在编译时显示错误错误:"Data.Repository.UnitofWork"未实现接口成员"Data.Repository.IUnitofWork.Customer"
请帮我解决此错误谢谢
区分大小写。这,在你的课堂上:
public ICustomer customer { get; private set; }
需要
public ICustomer Customer { get; private set; }
(大写 C,因为那是您界面上的内容)