I have a client, a business object (named UserInfo), and a web service. Both the web service and the client use the same business object.
In my client, I want to be able to write code like this:
LogError svc = new LogError();
ErrorInfo info = new ErrorInfo();
info.UserInfo = Globals.Instance.UserInfo
svc.LogException(info);
But, when the proxy is generated from the wsdl UserInfo is treated as a different object because it has a different namespace in the proxy definition, forcing me to write code like this:
LogError svc = new LogError();
ErrorInfo info = new ErrorInfo();
if (info.UserInfo == null)
{
info.UserInfo = new UserInfo();
}
info.UserInfo.Company = Globals.Instance.UserInfo.Company;
info.UserInfo.Email = Globals.Instance.UserInfo.Email;
info.UserInfo.UserName = Globals.Instance.UserInfo.UserName;
info.ExceptionDetails = richTextBox1.Text;
svc.Credentials = System.Net.CredentialCache.DefaultCredentials;
svc.LogException(info);
I could go into the generated proxy and change the namespace of UserInfo to be the same namespace as defined in the BusinessObject assembly, but that seems like a hack.
Can I do something in the WSDL, or web method, or the definition of the ErrorInfo object class defnition to force the WSDL to generate the proper namespace for the UserInfo object?