Cyberactiva - webmaster tutorials, programming and videogames tricks

webmaster menu webmaster menu webmaster menu webmaster menu webmaster menu webmaster menu webmaster menu webmaster menu
  

Generated proxy class conflicts with custom class --REVISED--

Generated proxy class conflicts with custom class --REVISED--
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());

Hello Walter,

Thank you for your reply!

I was afraid that manually editing the generated proxy class(es) would have
been the only solution, because I will have to manually update them in case I
update the web service.

--
Fabio Scagliola
http://fabioscagliola.com



Register for freeMembers Area
Web MarketingLast Web Marketing
Web MarketingLast Programming Tips
Web MarketingLast News


Web Marketing Links and links exchange .