datacontract Questions

10

Solved

I have an enum: public enum Action { Remove=1, Add=2 } And a class: [DataContract] public class Container { [DataMember] public Action Action {get; set;} } When serialize instance of Cont...
Hoarsen asked 6/2, 2012 at 7:21

8

I am very confused about the DataContract attribute in WCF. As per my knowledge it is used for serializating user defined type like classes. I wrote one class which is exposed at client side like t...
Nakitanalani asked 29/1, 2011 at 11:49

5

Solved

I'm currently creating a .NET C# API. I have many classes, and some of them have to be transferred through a REST service as JSON. For example, I may have an account object with a lot of business m...
Goodyear asked 1/2, 2013 at 18:12

4

Solved

I have a datacontract like this [DataContract] class MyDC { [DataMember] public string DM1; [DataMember] public string DM2; [DataMember] public string DM3; } and sometimes I want to pre...
Preglacial asked 29/7, 2010 at 0:10

6

Solved

I can't find the namespace to use for [DataContract] and [DataMember] elements. According to what I've found, it seems that adding the following should be enough, but in my case it is not. using S...
Adena asked 13/9, 2011 at 12:23

6

Solved

Is there a generally accepted way to avoid having to use KnownType attributes on WCF services? I've been doing some research, and it looks like there are two options: Data contract resolver NetDa...
Coaler asked 25/4, 2013 at 16:38

3

Solved

I need to have some data members get some values when I create an instance of the DataContract on the client. This is not happening using constructors. I have searched through different forums and ...
Sidney asked 11/6, 2011 at 13:18

3

I've got a WCF service, in which there are operations which accept a non-generic base class as parameter. [DataContract] class Foo { ... } This base class is in turn inherited, by such generics ...
Smiley asked 13/3, 2010 at 11:21

1

Solved

I got a weird problem where I can serialize a derived class if I put it in a List but not when it stands on it own. I am using these methods to serialize and deserialize (found them here): publi...
Pigmentation asked 1/8, 2017 at 16:31

0

I am implementing C# WCF SOAP 1.1 service (server-side) from a given wsdl (contract first development). The problem I am facing is that there are additional (non-wsdl) formatting requirements for x...
Godoy asked 31/5, 2017 at 16:33

3

I have a wcf contract that works with client v1. Now I'm working on service v2, and i want to mark some of the fields as deprecated, So client v1 will see and use them, and client v2 will ignore ...
Quandary asked 23/3, 2011 at 11:57

3

Solved

I am developing a WCF service which will be consumed by multiple different client applications. In order to make one functionality work, the server needs to read an XML file into a C# DataContract ...
Zonnya asked 21/6, 2012 at 16:8

5

Solved

I was curious if someone could outline which types of WCF contract (interface) changes on the server side would break a client trying to send in a message, and why. I believe WCF can handle certain...
Ioves asked 11/3, 2009 at 2:13

6

We are running into a situation on an MVC3 project with both the Microsoft JSON serializers and JSON.NET. Everybody knows DateTime's are basically broken in Microsoft's serializers, so we switched...
Preiser asked 15/6, 2012 at 17:7

3

Solved

I am porting a .NET Framework C# class library to a Portable Class Library. One recurring problem is how to deal with classes decorated with the [Serializable] attribute, since this attribute is no...

2

Solved

Is there any tool allowing to generate DataContract entity definitions based on a JSON sample? I'm really missing the old good WSDL metadata with code generation facilities.
Hiroshige asked 28/10, 2011 at 18:20

8

Solved

I'm trying to return a complex type from a service method in WCF. I'm using C# and .NET 4. This complex type is meant to be invariant (the same way .net strings are). Furthermore, the service only ...
Boredom asked 22/3, 2010 at 18:54

5

Solved

I have a server side class which I make available on the client side through a [DataContract]. This class has a readonly field which I'd like to make available through a property. However, I'm unab...
Thermostatics asked 9/12, 2009 at 13:2

3

Solved

Is there a way to choose default values of attributes that are not in the xml file during deserialization? If the mAge attribute is not present in the xml file, I want to use a default value of 18....
Meed asked 19/12, 2011 at 19:12

4

Solved

I want to be able to generate a DataContract from a XSD file, preferably using the xsd.exe tool. What is the easiest way for it to auto generate the [DataContract] and [DataMember] on each of my it...
Presbyopia asked 3/2, 2010 at 0:41

3

I have a WCF Service project in Visual Studio 2008 that contains about 12 methods, some of which return primitive types like bool or string. I also have a Visual Studio Unit Test Project that refer...
Stereogram asked 29/10, 2009 at 10:3

1

I have the following code: [ServiceContract(Name = "Save{0}")] public ISave<T> where T : BusinessObject { [OperationContract(Name = "Save")] void Save(T obj); } public class SaveCustomer ...
Exile asked 7/3, 2014 at 15:54

2

Solved

I manage a number of Bed & Breakfast websites and run a kind of booking engine to help the client do bookings directly on their website (as opposed to going to another site to close the deal). ...
Forwent asked 17/5, 2014 at 17:0

4

How bad is it? I have read countless articles and never created abstract DataContracts with behavior before, but it seems that doing so will solve an issue I am having that will prevent me from cre...
Although asked 13/7, 2009 at 17:50

1

Solved

I have this code: [DataContract] class MyData { private Int32 dato1; [DataMember] public Int32 Dato1 { get { return dato1; } set { dato1 = value; } } public MyData(Int32 dato1) { this.d...
Arella asked 29/3, 2014 at 11:6

© 2022 - 2024 — McMap. All rights reserved.