Possible Duplicate:
Passing Interface in a WCF Service?
I’ve a problem regarding WCF and interfaces.
I’ve have two classes
public interface ICompany {
string Name { get; set; }
IAddress Address { get; set; }
}
class Company : ICompany {
public string Name { get; set; }
public IAddress Address { get; set; }
}
public interface IAddress {
string Road { get; set; }
}
class Address: IAddress {
string Road { get; set; }
}
And my service returns
[OperationContract]
Company GetCompany(String name);
But this doesn’t work, I’m sure the problem is the IAddress inside the Company class, but can’t this be solved somehow?
Your classes must declare as:
and your service declare and implement as:
Only after that you can use this service.
And I recommend to read more that