How to make my client application recognize an object from my web service as a type that it already knows?

So, I have a web service that returns a non-standard type

public List<MyNS.Product> GetProducts(string filter)
{
    ...
}

MyNS.Productdefined in another assembly. The client application refers to the same assembly. When I add a service link to my client application, the return type is MyServiceReference.Product.

var client = new MyServiceReference.dataSoapClient();
var products = client.GetProducts("derp");
// products type is MyServiceReference.Product[]

How do I get my client application to recognize that the returned type object MyServiceReference.Productis actually a type MyNS.Productthat it already knows about? (the list for the array is not big, just type T)

The web service is a regular asmx as part of the website. I am doing an “add service link” to add a service to my client’s project in visual studio.

edit: "" " ". . , .

add service reference options

+3
5

, - ( ), - -, .

-, IDE , -, , SOAP. , Product, Product, .

+2

, VS -. -, visual studio - .

+3

- , WCF, - asmx. ASMX SchemaImporterExtension:

: . , , , . [XmlSerializerFormat] , [SerializableAttribute]

0

(.asmx - SOAP), soap wsdl, asmx, , xml-,

dto ( ) , , , , .

-NET-, , SOAP- .NET Java .

0

, , , ( ) , , .

- asmx (.net version 2.0), -, ( [serializable]), , ( - ).

, , ( ), Reference.cs( , " ",).

N.B. .NET 2.0

!

, -, ! LOT.

(reference.cs), , inerith ( ), . , , .

, , - (: "_" [YOUR_BASECLASS_NAME = > _YOUR_BASECLASS_NAME]), "" Reference.cs - :

using YOUR_BASECLASS_NAME = SHAREDLIBRARY.BASECLASS
using YOUR_CLASS_NAME = SHAREDLIBRARY.CLASS

, .

Compile ..et voilà! I know that this is not a very good solution, but it is the smartest I have found.

0
source

All Articles