开发者

What does it do when you add a service reference in Visual Studio, through the GUI?

开发者 https://www.devze.com 2023-01-25 03:41 出处:网络
I\'m currently trying to call a WCF service dynamically See here, therefore, I\'m trying t开发者_运维问答o understand what happens behind, when I add a service reference by the GUI of Visual Studio...

I'm currently trying to call a WCF service dynamically See here, therefore, I'm trying t开发者_运维问答o understand what happens behind, when I add a service reference by the GUI of Visual Studio... What's generated..? An object is created and an implicit reference is created...

Are the references contained in a specific container, a sort of pool?


When you add a service reference, VS generates a proxy class for the service. This class implements the interface defined by your service endpoint as its ServiceContract, so it appears to consuming code as if it were the actual object performing the operations, but it contains and uses the communication channel defined by the endpoint and bindings to call the exposed service methods.

If you do not have classes that conform to the signatures of the DataContracts required by the service, VS will generate those classes as well, but if you have already referenced classes that are marked identically to the DataContract (usually because you've referenced the project containing the DataContracts in the project with the client-side code) it will simply use those. Svcutil (the command-line tool) can be given a reference list of locations for these DataContracts as well.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号