wcf - Why does a Web Service DataMember's Specified Attribute need to be set for int and Data but not for String -


I have created a web service through WCF, after which I have highlighted it as a web service, which is a . Make usable with the NET 2.0 application. I have created some data contracts with the datamember which can be used by the Exploration Operation Contract.

I have noticed that when I try to create a data class in the web service, each attribute for each member of the "specified" attribute is now attributed to each data contract feature.

For example:

  [DataContract] Public category sales {[Database] Public Invoice Invoice; ...}  

When I make an example of a sale in the Web service client, I get the characteristic of the invoice name and the invoice is not specified.

Now my question is, when the attribute is of type string, I do not need to set the corresponding "specified" attribute to the right, but when the type of attribute is an int or datetime, if I If the correct "specified" attribute is not set to true, then the value becomes zero in the web service host. Is there a way to avoid setting specific attributes? Because I need to call web service functions in many places of my code.

The default parameters for the data field feature are:

  bool EmitDefaultValue (default is true) bool IsRequired (default false)  

If the property you are exposing is a non-null value type that you should use:

[IsRequired = true]; Not Public Invoice;

Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -