Hi. I am creating some contracts and implementing them in a WCF service. I have the following code:
public interface IContent
{
[OperationContract]
bool AddContent(string description, string location, int userID);
}
[DataContract]
public class ContentData
{
[DataMember]
public String Description;
[DataMember]
public String Location;
}
It is implemented as thus:
public bool AddContent(string description, string location, int userID)
{
...
}
When I run the service in the test client, and for location pass a path, such as:
E:\My Documents\Content\testcontent.txt
A DbEntityValidationException error is thrown with the Error Message: The
Location field is required.
On debugging, the
location parameter in the implementation comes in
null.
When I try and pass a plain string for
location without the path's '\', e.g. if I enter a value such as "This should work!", it works :-(..
How can is solve the backslash problem? I am confused on what could be wrong.