I'm trying to return a class that implements the IList interface and
has a few other data members as well.
// User Node class
[Serializable]
[XmlRootAttribute("User")]
public class User
{
private string m_username = "";
private string m_userpassword = "";
private string m_userDisplayName = "";
public User()
{
}
public User(string pUsername, string pUserpassword, string
pUserDisplayName)
{
m_username = pUsername;
m_userpassword = pUserpassword;
m_userDisplayName = pUserDisplayName;
}
[XmlElementAttribute(Type = typeof(string), IsNullable = false)]
public string UserName
{
get { return m_username; }
set { m_username = value; }
}
[XmlElementAttribute(Type = typeof(string), IsNullable = false)]
public string UserDisplayName
{
get { return m_userDisplayName; }
set { m_userDisplayName = value; }
}
[XmlElementAttribute(Type = typeof(string), IsNullable = false)]
public string UserPassword
{
get { return m_userpassword; }
set { m_userpassword = value; }
}
}
// UserList class
[Serializable]
[XmlRootAttribute("UserList")]
public class UserList : ReturnSet, IList<User>
{
// IList members
[XmlArrayAttribute("Users")]
[XmlArrayItemAttribute("User", typeof(User))]
public User[] Users
{
get { return (User[])m_list.ToArray(typeof(User)); }
set
{
m_list = new ArrayList(value);
}
}
private bool m_lockdownHandheld = false;
private bool m_deleteAllData = false;
[XmlElementAttribute("Lockdown")]
public bool Lockdown
{
get { return m_lockdown; }
set { m_lockdown = value; }
}
[XmlElementAttribute("DeleteAllData")]
public bool DeleteAllData
{
get { return m_deleteAllData; }
set { m_deleteAllData = value; }
}
}
What I expect to get back when the web service call is made is an XML
similar to the following:
<UserList xmlns...>
<Lockdown>False</Lockdown>
<DeleteAllData>False</DeleteAllData>
<Users>
<User>
<UserName>Rob</UserName>
<UserPassword>12345</UserPassword>
<UserDisplayName>Rob Smith</UserDisplayName>
<User>
<User>....</User>
</Users>
</UserList>
What I am seeing instead is the following:
<UserList xmlns...>
<User>
<UserName>Rob</UserName>
<UserPassword>12345</UserPassword>
<UserDisplayName>Rob Smith</UserDisplayName>
</User>
<User>....</User>
</UserList>
The Lockdown and DeleteAllData properties of the UserList class are
being ignored.
I'm trying to return a list of Users (Or whatever data object) and
some control data to a client application. (i.e. Lockdown = True take
some action to disable the client software) Is there anyway to
accomplish what I am trying to do here?
Thanks for your help.
-Rob-