What is DataContract, DataMember And Serializer in WCF? [Resolved]

Posted by Kumarkrishna184 under WCF on 11/23/2015 | Points: 10 | Views : 2112 | Status : [Member] | Replies : 4
What is DataContract, DataMember And Serializer in WCF?

Thanks and Regards,
Krishna Kumar



Responses

Posted by: Sheonarayan on: 11/23/2015 [Administrator] HonoraryPlatinum | Points: 50

Up
0
Down

Resolved
Before you understand DataContract and DataMember, you should understand what is serializer. Serializer translates the .net objects to xml and vice-versa. In almost all cases the object can't be transferred from one location to another so it needs to be converted into string (xml) and then xml back to object and that is what the Serializer does.

DataContract and DataMember are attributes used in the .net classes that should be serialized and passed through input or output from WCF.

DataContract is the attribute that must be used to the class being used in WCF.

DataMember is the attribute that must be used to the class properties. If a class property doesn't have DataMember attribute that property will not be serialized that means that this property would not be available to use by the service consumer.

Read more about this at http://www.dotnetfunda.com/articles/show/1796/abc-of-wcf and http://www.dotnetfunda.com/articles/show/1089/wcf-basics-of-datacontract.

Hope this will help.

Thanks


Regards,
Sheo Narayan
http://www.dotnetfunda.com

Kumarkrishna184, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Kumarkrishna184 on: 11/24/2015 [Member] Starter | Points: 25

Up
0
Down
Thanks Alot Sir

Thanks and Regards,
Krishna Kumar

Kumarkrishna184, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sheonarayan on: 11/24/2015 [Administrator] HonoraryPlatinum | Points: 25

Up
0
Down
Looks like this answer has helped you, you must mark the answer as "Answered" when you are satisfied with the answer so that it helps other.

Thanks

Regards,
Sheo Narayan
http://www.dotnetfunda.com

Kumarkrishna184, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Kumarkrishna184 on: 11/25/2015 [Member] Starter | Points: 25

Up
0
Down
ok sir....

Thanks and Regards,
Krishna Kumar

Kumarkrishna184, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response