netdatacontractserializer

Problem deserializing with NetDataContractSerializer after refactoring code

纵然是瞬间 提交于 2020-02-27 07:26:18
问题 I have a situation where I'm serializing some .NET objects using NetDataContractSerializer and storing the XML in a database as a way to remember the state of these objects within an application. Recently I just came across the first situation where some code refactoring of property and type names has resulted in the failure to deserialize this XML data. So far I've come up with two different plans of attack for how to deal with version compatibility breaks such as these which are to use

Does the compact framework 3.5 support System.Runtime.Serialization?

孤街浪徒 提交于 2019-12-22 08:20:04
问题 I am writing a library which is a set of classes meant to be shared between many different .NET applications, including at least one which uses the .NET compact framework. I have been making these classes use the [DataContract] attribute with a bunch of [DataMember]s so that they are easy to serialize and deserialize using the DataContractJSONSerializer. I have been searching the web to try to find out if this functionality (DataContractAttribute, DataMemberAttribute, and

NetDataContractSerializer vs DataContractSerializer

痞子三分冷 提交于 2019-12-19 06:14:10
问题 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. What's the difference in sizes between the objects created by the two? Is

NetDataContractSerializer vs DataContractSerializer

馋奶兔 提交于 2019-12-19 06:14:06
问题 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. What's the difference in sizes between the objects created by the two? Is

Protobuf .NET serialization for inheritance classes

时光总嘲笑我的痴心妄想 提交于 2019-12-11 12:24:03
问题 I'm trying to migrate my code serializer from NetDataContract to Protobuf.Net. Let's consider the following class example to help the understanding: [DataContract(Name "a", IsReference = true)] class Test { [DataMember(Name = "a")] public int Id { get; set; } [DataMember(Name = "b")] public string Name { get; set; } } To be able to use Protobuf .NET using DataContract, I'm using the following options: RuntimeTypeModel.Default.InferTagFromNameDefault = true; RuntimeTypeModel.Default

Add Service Reference is ALWAYS generating xmlserializer and not DataContractSerializer

懵懂的女人 提交于 2019-12-11 02:39:00
问题 i have a service : http://chronicpainhostservice2.cloudapp.net/Service1.svc i consume it in silverlight 5.0 application. and it all worked fine. However, when i adding this service to the project using "add service reference" it ALWAYS generating xmlserializer One more thing - when i try to add it to simple windows application it is generating DataContractSerializer , so the problem is not in the server. How can i force silverlight to generate DataContractSerializer ? Thanks! 回答1: It looks

Avoiding using the “http://www.w3.org/2001/XMLSchema-instance” namespace with .Net DataContractSerializer

点点圈 提交于 2019-12-07 06:45:04
问题 I have a series of classes that I am converting to XML using .NET's DataContractSerializer in .NET 4.0. The serialisation is working fine, and I can parse the XML and recreate the .NET objects later without any difficulty. However, most of the DataMember's are not required. [DataMember(IsRequired = false)]. This works great on de-serializing the XML, where you can then just miss the XML node out of the document, but when serializing an exisiting object into XML, the DataContractSerializer

Modify the xml array element name in serialized ASP.NET WebAPI object

▼魔方 西西 提交于 2019-12-06 17:56:09
问题 I have been struggling with outputting a custom root xml element when returning a list of objects in my WebAPI controller. My controller method looks something like this: public List<Product> Get() { return repository.GetProducts(); } which renders an xml output like this: <ArrayOfProduct> <Product> <Name>Product1</Name> </Product> <Product> <Name>Product2</Name> </Product> </ArrayOfProduct> I would like to change <ArrayOfProduct> to <Products> but haven't found a way of doing so. I have

Modify the xml array element name in serialized ASP.NET WebAPI object

你离开我真会死。 提交于 2019-12-04 23:28:05
I have been struggling with outputting a custom root xml element when returning a list of objects in my WebAPI controller. My controller method looks something like this: public List<Product> Get() { return repository.GetProducts(); } which renders an xml output like this: <ArrayOfProduct> <Product> <Name>Product1</Name> </Product> <Product> <Name>Product2</Name> </Product> </ArrayOfProduct> I would like to change <ArrayOfProduct> to <Products> but haven't found a way of doing so. I have tried different variations of the DataContract and DataMember attributes to no avail. Does anyone know if

Problem deserializing with NetDataContractSerializer after refactoring code

久未见 提交于 2019-12-04 09:16:49
I have a situation where I'm serializing some .NET objects using NetDataContractSerializer and storing the XML in a database as a way to remember the state of these objects within an application. Recently I just came across the first situation where some code refactoring of property and type names has resulted in the failure to deserialize this XML data. So far I've come up with two different plans of attack for how to deal with version compatibility breaks such as these which are to use facilities available within the NetDataContractSerializer itself to control the deserialization or just to