WCF uses Svcutil.exe to generate client proxies

Source: Internet
Author: User
Tags silverlight

SvcUtil.exe

Parameters

1/async

/async generates both synchronous and asynchronous method signatures.

Default setting: Only the synchronization method signature is generated.

Abbreviated form:/A

2/tcv:version35

/tcv:version35

Specifies which version of the. NET Framework the application is targeting. Valid values are: Version30 and Version35. The default value is Version30.

Abbreviated form:/TCV

VERSION30: If code is generated for clients using the. NET Framework 3.0,/tcv:version30 is used.

VERSION35: If code is generated for clients using the. NET Framework 3.5,/tcv:version35 is used. If the/tcv:version35

Used with the/async switch, an event-based asynchronous method and an asynchronous method based on a callback/delegate are generated at the same time.

3/collectiontype:< type >

/collectiontype:< type >

When you generate code from a schema, you specify the fully qualified or assembly-qualified name that you want to use as the collection data type.

Abbreviated form:/CT

4/reference:< file path >

/reference:< file path >

Refers to the type in the specified assembly. Use this option when generating clients to specify which assemblies may contain types that represent the imported metadata.

You cannot use this switch to specify message contracts and XmlSerializer types.

If DateTimeOffset is referenced, the type is used instead of the new type is generated. If the application is written using the. NET Framework 3.5

, SvcUtil.exe will automatically refer to DateTimeOffset.

Abbreviated form:/R
5/enabledatabinding

/enabledatabinding

Implement the INotifyPropertyChanged interface on all data contract types to enable data binding.

Abbreviated form:/edb

Example:

1

Generate synchronization, asynchronous code with events, collection using System.Collections.ObjectModel.ObservableCollection collection, specifying assembly reference

svcutil/a/d:d:/temp http://localhost:1998/Implement/AgriProductService.svc/ser:DataContractSerializer  
      
/TCV: Version35/ct:system.collections.objectmodel.observablecollection ' 1/reference:c:/"program  
      
Files"/"reference Assemblies "/microsoft/framework/.netframework/v4.0/windowsbase.dll

Generates synchronous, asynchronous code with events, collection using System.Collections.Generic.List collection

svcutil/a/d:d:/temp http://localhost:1998/Implement/AgriProductService.svc/ser:DataContractSerializer  
      
/TCV: Version35/ct:system.collections.generic.list ' 1

Generate synchronization, asynchronous code with events, collection map to arrays

svcutil/a/d:d:/temp http://localhost:1998/Implement/AgriProductService.svc/ser:DataContractSerializer  
      
/TCV: Version35

A detailed introduction to svcutil.exe.

ServiceModel Metadata Utility (Svcutil.exe)

If the generated proxy class is to be used for Silverlight, you will need to modify it manually. Because Silverlight does not support synchronization, all code that needs to delete synchronization operations in the proxy class retains only asynchronous code, as well as the need to add the following code for the open and close client code.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.