datacontractserializer

Unexpected behaviour with requered ordering position XML node on ServiceStack WS

谁说胖子不能爱 提交于 2019-12-24 13:52:10
问题 Now as I know ServiceStack uses .NET's Xml DataContractSerializer to serialize/deserialize XML, but with it we have some truble in case when our webservice API used not .NET framework. This problem very good described in this post if try short describe of problem: Requirement of strict sequence of nodes XML is very uncomfortable for some external no. NET system. Is it possible to use a different serialize or configure the ServiceStack used, so that he did not expect the elements in a rigidly

How to serialize nullable DateTime in a WCF DataContract?

大憨熊 提交于 2019-12-24 12:42:06
问题 I am having trouble serializing this thing. namespace Such.Namespace.Wow { [DataContract(Namespace = "http://very.namespace.uh")] public class DogeResponse { [DataMember] public virtual int Foo { get; set; } [DataMember] public virtual DateTime? ExpiringDate { get; set; } } } In generated WSDL : <xs:complexType name="DogeResponse"> <xs:sequence> <xs:element minOccurs="0" name="Foo" type="xs:int"/> <xs:element minOccurs="0" name="ExpiringDate" nillable="true" type="xs:dateTime"/> </xs:sequence

Serializing MethodBase and Exception types in a WCF Service

廉价感情. 提交于 2019-12-24 09:57:56
问题 I created a WCF service for logging exceptions (I realize if the network is down, things won't be logged...there are fallbacks in place) Anyhow, it has two methods int LogException(MethodBase methodBase, Exception exception) int LogMessage(MethodBase methodBase, string message, string data) When I try and add the service to a new project, the .cs file is not created. I ran svcutil, and copied the .cs and config settings into the project, and tried calling the service with the generated client

SerializationException when returning custom classes from a WCF service

纵然是瞬间 提交于 2019-12-24 07:53:05
问题 I have the following classes... public abstract class Fallible<T> { } public class Success<T> : Fallible<T> { public Success(T value) { Value = value; } public T Value { get; private set; } } The background to this can be found in a previous question of mine, but you don't need to read that post as the classes above are all that's needed to see the problem. If I have a simplified WCF service call like this... [OperationContract] public Fallible<Patient> GetPatient(int id) { return new Success

How to use WCF services without DataContract and DataMember?

女生的网名这么多〃 提交于 2019-12-24 07:19:03
问题 I'm working on a web application and serializing objects using JSON.Net .now, i want to add some WCF services to this application that will be used in any platform for example android. now, when i send a simple ajax request to web service, it's go to infinite loop and chrome console logs net::ERR_CONNECTION_RESET , but when i add DataContract to the model, this problems get to solved, but in the other forms in the entire of application, JSON.Net does not serialize objects. Here is my codes:

Problems with the DataContractSerialiser and Serializable

ぐ巨炮叔叔 提交于 2019-12-24 04:33:14
问题 I've a few Classes from a asembly wich is .Net 2.0. These Classes are makred with Serializable. In my Project, i uses this classes in my Classes, wich are marked with DataContract(IsReference=true) and DataMember. Now I have the Problem, with DataContractSerialiser that it serialises the private fields of my .Net 2.0 Classes, wich will not work. But when I use XMLSerialiser, i cannot use IsReference, and so I can also not do this. Is there a easy (simple) Solutiuon for this? Maybe a someone

How to remove root element of list when serializing with DataContracts

主宰稳场 提交于 2019-12-24 04:07:05
问题 I have this class [DataContract] public class InsertLoansResponse { private ProcSummary _processingSummary; private List<InsertLoanResponse> _items; [DataMember] public List<InsertLoanResponse> InsertLoanResponses { get { return _items ?? (_items = new List<InsertLoanResponse>()); } set { _items = value; } } [DataMember] public ProcSummary ProcessingSummary { get { return _processingSummary ?? (_processingSummary = new ProcSummary()); } set { _processingSummary = value; } } public void Add

Cannot serialize member … of type System.Collections.Generic.Dictionary`2 because it implements IDictionary

白昼怎懂夜的黑 提交于 2019-12-24 01:03:30
问题 I am trying to pass a class with a Dictionary property over WCF and it is failing for one method but works for another. When the class is returned inside a List , it works. But when the class is returned inside a DataTable , the client just says the connection was disconnected and no error shows up. Here is the class causing issues: [DataContract] public class DetailLog { [DataMember] public string Name { get; set; } [DataMember] public string SubAction { get; set; } [DataMember] public

How can I set the StreamingContext in Silverlight DataContractSerizer?

和自甴很熟 提交于 2019-12-24 00:38:02
问题 I need to do a deep copy in Silverlight, which I can do with the tried and tested serialize/deserialize approach. The copied objects aren't exact clones - they need to have some of their properties modified on the copy. I should be able to do something like this: [OnDeserialized()] public void OnDeserializedMethod(StreamingContext context) { if (context.State == StreamingContextStates.Clone) { //stuff } } where the StreamingContext is set up using a NetDataContractSerializer :

DataContract SerializationException when using list of predicates

二次信任 提交于 2019-12-23 21:16:13
问题 I'm writing a generic filter class that will be primarily used to filter persons from a population. I'm trying to serialize the filter class, but at runtime I get an SerializationException: System.Runtime.Serialization.SerializationException : Type 'System.DelegateSerializationHolder+DelegateEntry' with data contract name 'DelegateSerializationHolder.DelegateEntry:http://schemas.datacontract.org/2004/07/System' is not expected. Consider using a DataContractResolver or add any types not known