Imagine I have this class
namespace CommonLibrary
{
public class Report()
{
public DateTime Begin { get; set; }
public int Count { get; set; }
}
}
This is the return type of a WCF Service method. When I use svcutil.exe it regenerates the class from metadata:
namespace CommonLibrary
{
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "3.0.0.0")]
[System.Runtime.Serialization.DataContractAttribute(Name="TrafficProblemReport", Namespace="http://schemas.datacontract.org/2004/07/Indica")]
public partial class TrafficProblemReport : object, System.Runtime.Serialization.IExtensibleDataObject
{
private System.Runtime.Serialization.ExtensionDataObject extensionDataField;
private System.DateTime BeginField;
private int CountField;
[System.Runtime.Serialization.DataMemberAttribute()]
public System.DateTime Begin
{
get
{
return this.BeginField;
}
set
{
this.BeginField = value;
}
}
[System.Runtime.Serialization.DataMemberAttribute()]
public int Count
{
get
{
return this.CountField;
}
set
{
this.CountField = value;
}
}
}
}
But it conflicts with the CommonLibrary definition. I am having compilation errors when I try to pass the Webservice method result (Report) to a CommonLibrary's method:
Error 4 The best overloaded method match for 'CommonLibrary.ClassName.MethodName(CommonLibrary.Report)' has some invalid arguments
How to solve this without creating additional namespaces? (I want to avoid type conversion)