An ASP.NET 2.0 web site contains a web form and a web service. The web form
consumes the web service. There is a Book class in the App_Code folder. The
web service exposes a method that returns a Book object. The consumer
includes a method that require a Book parameter. However the Book generated
proxy class conflicts with the Book class in the App_Code folder. Please,
consider the following code. I bet there is an easy way to solve this, but I
have no idea...
Thanks,
Fabio
// App_code/ClassLibrary.cs
namespace ClassLibrary
{
public class Book { ... }
}
// WebService.asmx
namespace WebService
{
[WebService(Namespace = "...")]
public class BookWebService : WebService
{
[WebMethod()]
public ClassLibrary.Book GetBook() { ... }
}
}
// Consumer.aspx
public partial class Consumer : Page
{
protected void Button1_Click(object sender, EventArgs e)
{
WebReference.BookWebService ws =
new WebReference.BookWebService;
private void ReadBook(ClassLibrary.Book book) { ... }
// The following statement does not compile:
// Cannot implicitly convert type 'WebReference.Book' to 'ClassLibrary.Book'
ReadBook(ws.GetBook());
}
}