I want to create a DataContract that is a class with 2 different List members. When I try to start the web service, I get the error that my method, SendEmail, is not supported by the Test WCF Client. This is my Data Contract:
[DataContract]
[KnownType(typeof(int[]))]
public class EmailInfo
{
private string strFromUserID = string.Empty;
private string strFromAddress = string.Empty;
private string strFromName = string.Empty;
private object lstIndividualIDs = null;
private object lstGroupIDs = null;
private string strSubject = string.Empty;
private string strMessage = string.Empty;
[DataMember]
public string FromUserID
{
get { return strFromUserID; }
set { strFromUserID = value; }
}
[DataMember]
public string FromAddress
{
get { return strFromAddress; }
set { strFromAddress = value; }
}
[DataMember]
public string FromName
{
get { return strFromName; }
set { strFromName = value; }
}
[DataMember]
public object IndividualIDs
{
get { return lstIndividualIDs; }
set { lstIndividualIDs = value; }
}
[DataMember]
public object GroupIDs
{
get { return lstGroupIDs; }
set { lstGroupIDs = value; }
}
[DataMember]
public string Subject
{
get { return strSubject; }
set { strSubject = value; }
}
[DataMember]
public string Message
{
get { return strMessage; }
set { strMessage = value; }
}
}
This is my method that uses the DataContract:
public string SendEmail(EmailInfo emailInfo)
{
string tstrErrorMsg = string.Empty;
SqlConnection SqlConn = null;
try
{
return tstrErrorMsg;
}
catch (Exception ex)
{
return null;
}
finally
{
if (SqlConn != null)
{
SqlConn.Close();
}
}
}
I would like to have a DataMember in the DataContract that is of type List. How do I add that type to a DataContract?