먼저이 질문에 대한 언급이 정확하지 않은 경우 사과드립니다.서비스중인 인터페이스 멤버를 구현하지 않음
3 층 MVC 3
애플리케이션을 개발 중입니다. 비즈니스 계층에서는 기존 마을 목록을 검색하기 위해 데이터 액세스 계층을 호출 할 서비스를 만들어야합니다.
내 ITown
인터페이스는 다음과 같습니다. 다음과 같이 Town.svc.cs
에서
[ServiceContract]
public interface ITown
{
[OperationContract]
IEnumerable<Town> GetAllTowns();
}
, 나는 삽입하고;
public class Town : ITown
{
public IEnumerable<Common.Town> GetAllTowns()
{
return new DATown().GetAllTowns();
}
}
위의 코드에 문제가 있습니다. public class Town : ITown
클래스의 Town
아래에 오류가 표시됩니다.
'Business.Town' does not implement interface member 'Business.ITown.GetAllTowns()'.
'Business.Town.GetAllTowns()' cannot implement 'Business.ITown.GetAllTowns()'
because it does not have the matching return type of 'System.Collections.Generic.IEnumerable<Business.Town>'.
이것은 내 DATown
의 내용입니다.
public class DATown : Connection
{
//Constructor
public DATown()
:base()
{ }
public IEnumerable<Town> GetAllTowns()
{
return entities.Town.AsEnumerable();
}
}
그래서 기본적으로 내가 뭐하는 거지 무엇 Town.svc.cs
클래스 DATown
의 GetAllTowns()
메소드를 호출합니다.
다른 비슷한 검색어를 검색했습니다. 대부분이 방법 중 하나에 올바른 매개 변수가 있다고 말합니다. 나는 이것이 내 코드의 경우라고 생각하지 않는다.
내가 잘못 생각한 사람을 도와 주시면 감사하겠습니다.
미리 감사드립니다. 당신의 타운 클래스에서
고마워요. :)이 문제가 해결되었습니다. – ClaireG