datacontractserializer

WCF Error “Maximum number of items that can be serialized or deserialized in an object graph is '65536'”

本小妞迷上赌 提交于 2019-11-26 16:45:07
I am receiving the following error on a WCF call: Maximum number of items that can be serialized or deserialized in an object graph is '65536' I've read a ton of forum posts and many of them mention modifying the app.config and web.config to specify new behavior to allow larger object graphs. I've done that and this is what I have in those files: App.Config on the WPF project: <system.serviceModel> <behaviors> <serviceBehaviors> <behavior name=""> <serviceMetadata httpGetEnabled="false" /> <serviceDebug includeExceptionDetailInFaults="false" /> </behavior> </serviceBehaviors>

Using DataContractSerializer to serialize, but can&#39;t deserialize back

人盡茶涼 提交于 2019-11-26 15:12:50
问题 I have the following 2 functions: public static string Serialize(object obj) { DataContractSerializer serializer = new DataContractSerializer(obj.GetType()); MemoryStream memoryStream = new MemoryStream(); serializer.WriteObject(memoryStream, obj); return Encoding.UTF8.GetString(memoryStream.GetBuffer()); } public static object Deserialize(string xml, Type toType) { MemoryStream memoryStream = new MemoryStream(Encoding.UTF8.GetBytes(xml)); // memoryStream.Position = 0L; XmlDictionaryReader

XSLT Transform XML with Namespaces

落花浮王杯 提交于 2019-11-26 12:56:21
问题 I\'m trying to transform some XML into HTML using XSLT . Problem: I can\'t get it to work. Can someone tell me what I\'m doing wrong? XML: <ArrayOfBrokerage xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns=\"http://www.test.com/\"> <Brokerage> <BrokerageID>91</BrokerageID> <LastYodleeUpdate>0001-01-01T00:00:00</LastYodleeUpdate> <Name>E*TRADE</Name> <Validation i:nil=\"true\" /> <Username>PersonalTradingTesting</Username> </Brokerage> </ArrayOfBrokerage> XSLT: <xsl:stylesheet

“Type not expected”, using DataContractSerializer - but it&#39;s just a simple class, no funny stuff?

十年热恋 提交于 2019-11-26 11:28:43
问题 I\'m refactoring my XML-serialization, and figured I\'d try the DataContractSerializer. Everything runs smoothly, until it needs to serialize this class: using System; using System.Runtime.Serialization; namespace VDB_Sync.Model { [DataContract(Name=\"Konstant\")] public class Konstant : DataFelt { [DataMember] private MySqlDbType mydataType; [DataMember] private object value; public Konstant(string navn, MySqlDbType dataType, object value) : base(navn, dataType, \"*Konstant\", false, false)

DataContractSerializer doesn&#39;t call my constructor?

家住魔仙堡 提交于 2019-11-26 09:00:03
问题 I just realized something crazy, which I assumed to be completely impossible : when deserializing an object, the DataContractSerializer doesn\'t call the constructor ! Take this class, for instance : [DataContract] public class Book { public Book() { // breakpoint here } [DataMember(Order = 0)] public string Title { get; set; } [DataMember(Order = 1)] public string Author { get; set; } [DataMember(Order = 2)] public string Summary { get; set; } } When I deserialize an object of that class,

Why doesn&#39;t the XmlSerializer need the type to be marked [Serializable]?

£可爱£侵袭症+ 提交于 2019-11-26 08:24:54
问题 In C#, if I want to serialize an instance with XmlSerializer , the object\'s type doesn\'t have to be marked with [Serializable] attribute. However, for other serialization approaches, such as DataContractSerializer , needs the class be marked as [Serializable] or [DataContract] . Is there any standard or pattern about serialization requirement? 回答1: This is because XmlSerializer only serializes public fields/properties. Other forms of serialization can serialize private data, which

Data Contract Serializer - How to omit the outer element of a collection

泄露秘密 提交于 2019-11-26 07:49:08
问题 How do I serialize a list without the outer element using the Data Contract Serializer? I am using .Net 3.5. I have a class that contains a list, amongst other things, that I wish to serialize without the outer element to be compliant with the pertinent XSD: [DataContract(Name=\"MyClass\")] public class MyClass { ... [DataMember(Name=\"Parameters\")] public List<Parameter> Parameters; ... } [DataContract(Name=\"Parameter\")] public struct Parameter { [DataMember(Name=\"ValueName\")]string

WCF Error “Maximum number of items that can be serialized or deserialized in an object graph is &#39;65536&#39;”

淺唱寂寞╮ 提交于 2019-11-26 04:55:43
问题 I am receiving the following error on a WCF call: Maximum number of items that can be serialized or deserialized in an object graph is \'65536\' I\'ve read a ton of forum posts and many of them mention modifying the app.config and web.config to specify new behavior to allow larger object graphs. I\'ve done that and this is what I have in those files: App.Config on the WPF project: <system.serviceModel> <behaviors> <serviceBehaviors> <behavior name=\"\"> <serviceMetadata httpGetEnabled=\"false

XML Serialization and namespace prefixes

别说谁变了你拦得住时间么 提交于 2019-11-26 04:45:30
I'm looking for a way with C# which I can serialize a class into XML and add a namespace, but define the prefix which that namespace will use. Ultimately I'm trying to generate the following XML: <myNamespace:Node xmlns:myNamespace="..."> <childNode>something in here</childNode> </myNamespace:Node> I know with both the DataContractSerializer and the XmlSerializer I can add a namespace, but they seem to generate a prefix internally, with something that I'm not able to control. Am I able to control it with either of these serializers (I can use either of them)? If I'm not able to control the

XML Serialization and namespace prefixes

扶醉桌前 提交于 2019-11-26 03:25:21
问题 I\'m looking for a way with C# which I can serialize a class into XML and add a namespace, but define the prefix which that namespace will use. Ultimately I\'m trying to generate the following XML: <myNamespace:Node xmlns:myNamespace=\"...\"> <childNode>something in here</childNode> </myNamespace:Node> I know with both the DataContractSerializer and the XmlSerializer I can add a namespace, but they seem to generate a prefix internally, with something that I\'m not able to control. Am I able