We have an application with objects that we'd like to keep serialized in the database.
Currently we're using NetDataContractSerializer
, but recently found out that due to the .Net
types information involved, it creates huge files which means slow application, even for basic objects.
We're considering switching to DataContractSerializer
instead, and I've been looking for a nice comparison of the two but didn't find one.
List<X>
, where X
is inherited by multiple other objects, so that the list contains many different types at runtime? (I was told that DataContractSerializer
can be given KnownTypes
attributes, but this means more dependencies in the code. Is there a way to make DataContractSerializer
know all that types in my solution?) Thanks.
DataContractSerializer as the Default By default WCF uses the DataContractSerializer class to serialize data types.
Windows Communication Foundation (WCF) uses the DataContractSerializer as its default serialization engine to convert data into XML and to convert XML back into data.
DataContractResolver
if you don't want to work with known types. An example of such a resolver can be found in Youssef Massaoui's blog, and some more information on the resolver itself can be found at my post on WCF extensibility at http://blogs.msdn.com/b/carlosfigueira/archive/2011/09/21/wcf-extensibility-data-contract-resolver.aspx.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With