Click here to Skip to main content
13,046,480 members (72,381 online)
Rate this:
Please Sign up or sign in to vote.
See more:
I am using a 3rd Party plugin in my MVC Application.
For which i am using 1 Class.cs file & 5 .dlls.

Now in my WCF service i have a IService (Interface) and in my .svc.cs file i am using the [operation contract] defined in the IService .
I have few 3 paratemeters used in the contaract to access the method in Class.cs

Now while trying to browse the WCF service it gives following Error:

Type 'Microsoft.TeamFoundation.Client.TfsTeamProjectCollection' cannot be serialized. Consider marking it with the DataContractAttribute attribute, and marking all of its members you want serialized with the DataMemberAttribute attribute. If the type is a collection, consider marking it with the CollectionDataContractAttribute. See the Microsoft .NET Framework documentation for other supported types.

Any suggestion , PLZ help.
Posted 15-Feb-13 19:39pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

If you cannot access to your 3rd-party libraries, and they don't use Data Contract, you cannot make those library to comply. No luck. Think about usefulness of these 3-rd parties for your work.

All you can do is to wrap all 3-rd party types you need into your own types which use Data Contract. But this is very tedious work, and the result of it will be very bad for maintenance. Think about it: you will have to reproduce all you have to serialize from scratch, as you cannot use as data members [DataMember] any of the 3-rd party types. You will have to develop parallel data types and convert them from and to 3-rd party types before serialization and after serialization (see the attributes OnDeserializedAttribute, OnDeserializingAttribute, OnSerializedAttribute and OnSerializingAttribute).

You can somehow automate and rationalize this unpleasant work, invent some universal tricks to alleviate the burden, but you cannot avoid it. Yes, I'm sure. Using 3-rd party libraries without source code is a very questionable thing.


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170713.1 | Last Updated 16 Feb 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100