Asked by:
Unable to comvert methods of class while converting class file to .xsd file using xsd.exe tool.

Question
-
Dear All,
I am trying to convert the .cs file to .xsd file. For that i have integrated the tool in my IDE.
Tool is converting my class file to .xsd but the main problem is that it is not converting the method of class to xsd file.
my class file code is as follows :
public class Student { private int _id; private string _firstName; private string _lastName; private string _loginName; private string _loginPassword; private string _gender; private string _mobileNo; private string _country; private string _state; private string _city; private string _education; private string _comment; private string _enqueryStatus; private DateTime _created; public int Id { get { return _id; } set { _id = value; } } public string FirstName { get { return _firstName; } set { _firstName = value; } } public string LastName { get { return _lastName; } set { _lastName = value; } } public string LoginName { get { return _loginName; } set { _loginName = value; } } public string LoginPassword { get { return _loginPassword; } set { _loginPassword = value; } } public string Gender { get { return _gender; } set { _gender = value; } } public string MobileNo { get { return _mobileNo; } set { _mobileNo = value; } } public string Country { get { return _country; } set { _country = value; } } public string State { get { return _state; } set { _state = value; } } public string City { get { return _city; } set { _city = value; } } public string Education { get { return _education; } set { _education = value; } } public string Comment { get { return _comment; } set { _comment = value; } } public string EnqueryStatus { get { return _enqueryStatus; } set { _enqueryStatus = value; } } public DateTime Created { get { return _created; } set { _created = value; } } public void addEnquiry(Student stud) { string query = "insert into Enquiry_Studen(SE_Enquiry_ID, SE_First_Name, SE_Last_Name, SE_Login_Name, SE_Password, SE_Gender, SE_Mobile_No, SE_Country, SE_State, SE_City, SE_Enquiry_Status, SE_Comment, SE_Creation_Date) values(@EnquiryID, @FirstName, @LastName, @LoginName, @Password, @Gender, @MobileNo, @Country, @State, @City, @EnqueryStatus, @Comment, @CreationDate)"; DBHandler dbHandler = DBHandler.getInstance(); SqlConnection con = new SqlConnection(dbHandler.connString); SqlCommand command = new SqlCommand(query, con); command.Parameters.Add("@EnquiryID", SqlDbType.VarChar).Value = 7; command.Parameters.Add("@FirstName", SqlDbType.VarChar).Value = stud.FirstName; command.Parameters.Add("@LastName", SqlDbType.VarChar).Value = stud.LastName; command.Parameters.Add("@LoginName", SqlDbType.VarChar).Value = stud.LoginName; command.Parameters.Add("@Password", SqlDbType.VarChar).Value = stud.LoginPassword; command.Parameters.Add("@Gender", SqlDbType.VarChar).Value = stud.Gender; command.Parameters.Add("@MobileNo", SqlDbType.VarChar).Value = stud.MobileNo; command.Parameters.Add("@Country", SqlDbType.VarChar).Value = stud.Country; command.Parameters.Add("@State", SqlDbType.VarChar).Value = stud.State; command.Parameters.Add("@City", SqlDbType.VarChar).Value = stud.City; command.Parameters.Add("@EnqueryStatus", SqlDbType.VarChar).Value = stud.EnqueryStatus; command.Parameters.Add("@Comment", SqlDbType.VarChar).Value = stud.Comment; command.Parameters.Add("@CreationDate", SqlDbType.Date).Value = stud.Created; using (con) { con.Open(); dbHandler.ExecuteNonQuery(command); } } public string getEnqueryStatus(int sid) { string Status; string query = "select SE_Enquiry_Status from Enquiry_Student where SE_Enquery_Id = @EnqueryID"; DBHandler dbHandler = DBHandler.getInstance(); SqlConnection con = new SqlConnection(dbHandler.connString); SqlCommand command = new SqlCommand(query, con); command.Parameters.Add("@EnqueryID", SqlDbType.Int).Value = sid; using (con) { con.Open(); Status = (string)dbHandler.ExecuteScaler(command); } return Status; } public bool validateUser(string lName, string lPassword) { SqlDataReader reader; string query = "select SE_Login_Name, SE_Password from Enquiry_Student where SE_Login_Name=@LoginName"; DBHandler dbHandler = DBHandler.getInstance(); SqlConnection con = new SqlConnection(dbHandler.connString); SqlCommand command = new SqlCommand(query, con); command.Parameters.Add("@LoginName", SqlDbType.VarChar).Value = lName; using (con) { con.Open(); reader = dbHandler.ExecuteDataReader(command); if (reader.HasRows) { reader.Read(); if (reader["SE_Login_Name"].ToString() == lName && reader["SE_Password"].ToString() == lPassword) { return true; } else { return false; } } else { return false; } } } } }
I am getting the .xsd file is as follows:
<?xml version="1.0" encoding="utf-8"?> <xs:schema xmlns:tns="XSDService" elementFormDefault="qualified" targetNamespace="XSDService" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="Student" nillable="true" type="tns:Student" /> <xs:complexType name="Student"> <xs:sequence> <xs:element minOccurs="1" maxOccurs="1" name="Id" type="xs:int" /> <xs:element minOccurs="0" maxOccurs="1" name="FirstName" type="xs:string" /> <xs:element minOccurs="0" maxOccurs="1" name="LastName" type="xs:string" /> <xs:element minOccurs="0" maxOccurs="1" name="LoginName" type="xs:string" /> <xs:element minOccurs="0" maxOccurs="1" name="LoginPassword" type="xs:string" /> <xs:element minOccurs="0" maxOccurs="1" name="Gender" type="xs:string" /> <xs:element minOccurs="0" maxOccurs="1" name="MobileNo" type="xs:string" /> <xs:element minOccurs="0" maxOccurs="1" name="Country" type="xs:string" /> <xs:element minOccurs="0" maxOccurs="1" name="State" type="xs:string" /> <xs:element minOccurs="0" maxOccurs="1" name="City" type="xs:string" /> <xs:element minOccurs="0" maxOccurs="1" name="Education" type="xs:string" /> <xs:element minOccurs="0" maxOccurs="1" name="Comment" type="xs:string" /> <xs:element minOccurs="0" maxOccurs="1" name="EnqueryStatus" type="xs:string" /> <xs:element minOccurs="1" maxOccurs="1" name="Created" type="xs:dateTime" /> </xs:sequence> </xs:complexType> </xs:schema>
It is not including class methods. Please teld me is there anything i am missing.
my arguments to tool are as follows :
Command : C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\xsd.exe
Arguments : /t:$(ItemFileName) $(TargetPath) /o:$(ItemDir)
Initial Directory : $(BinDir)
Tuesday, December 20, 2011 6:57 AM