There is some WCF application. The contract on the WCF host has this method:

public void InsertCar(ingentory car) { InsertCar(car.ID, car.Make, car.Color, car.PetNama); } 

As you can see, the method takes a non-standard data type. Therefore, for the client to work with this type, I implement the class using the [DataContract] and [DataMember] attributes:

  [DataContract] public class ingentory { [DataMember] public int? ID; [DataMember] public string Make; [DataMember] public string Color; [DataMember] public string PetNama; } 

And here I have a question. How to transfer the class ingentory from client to host. I understand that the client also needs to implement the ingentory class and just pass it on, and WCF will figure out what to push and where?

PS Not really figured out the WCF. I would be grateful - if you correct me.

    1 answer 1

    Understood. Once in the client application, we add a link to the service. We will have a namespace in which there will be an ingentory class and we will be able to use it in client code. For example, something like this:

     foreach (ServiceReference1.ingentory test in client.GetInventory()) { Console.WriteLine(test.ID); }