Questions tagged [datamember]

204 questions
1
vote
0 answers

Assigning value from DateTime to a nullable DateTime always gives kind 'Unspecified' instead of 'Utc'

I am trying to pass a value from a DateTime object to a DateTime? one as in the example. However, the kind always remains unspecified and is not passed to Utc as in the original object. What should I do differently? If I try something like the…
João Silva
  • 122
  • 10
1
vote
1 answer

Content-based Correlation in WF 4 on inherited DataMember property

In Windows Workflow Foundation under .NET 4.0, is there a way to correlate operations based on an inherited data member? For example given the following classes [DataContract] [KnownType(typeof(DerivedMessage))] public abstract class…
Jimit
  • 765
  • 2
  • 10
  • 18
1
vote
1 answer

Deserialize collection type virtual data member

I'm trying to deserialize json to RequestWithDefault object JSON: { "fields":["f1","f2"] } My simple class diagram: [DataContext] public abstract class BaseRequest { [DataMember] public virtual List Fields { get; set;…
Emil
  • 171
  • 1
  • 8
1
vote
2 answers

WCF REST Service: Method parameter (object) is always null

I've seen a few similar questions on here, but none have worked for this particular problem. I have a WCF Rest web service and its working ok for GET. One method is a POST, and whenever i call it passing the json parameter, the parameter that is…
the_tr00per
  • 439
  • 7
  • 23
1
vote
2 answers

How can I distinguish data member and function member with dir() in python?

class Vehicle: speed = 0 def __init__(self, speed): self.speed = speed def drive(self, distance): print 'need %f hour(s)' % (distance / self.speed) print dir(Vehicle) The Pycharm shows: ['__doc__', '__init__',…
youngtree
  • 53
  • 6
1
vote
1 answer

WCF custom DataContract/DataMember and CA1811: Avoid uncalled private code

I got a WCF service, and one of the return objects is: [DataContract] sealed class Class1 { [DataMember] public int Prop1 { get; private set; } ... } Incidentially, one of the properties, let's say it's this Prop1, I only set within the…
avance70
  • 787
  • 1
  • 11
  • 22
1
vote
2 answers

How does compiler know how other .cpp files use a static const member?

Could someone please explain me this example from the most authoritative ISO C++ FAQ? The code goes like this: // Fred.h class Fred { public: static const int maximum = 42; // ... }; // Fred.cpp #include "Fred.h" const int Fred::maximum; //…
sigil
  • 815
  • 8
  • 16
1
vote
2 answers

WCF tries to serialize members that are not attributed with [DataMember]

Given the following DataContract: [DataContract] public class GetGameSessionHistory : ValueBaseCasinoIT { [DataMember] public GameSession[] GameSessions => GameSessionsValue.ToArray(); public IEnumerable
chrsi
  • 992
  • 9
  • 24
1
vote
2 answers

WCF InvalidDataContractException: "Type cannot be serialized" but is marked correctly

I am getting an InvalidDataContractException: Type 'LicenseWatchingServiceLibrary.LicenseInfoContainerExpiring' cannot be serialized. Consider marking it [...] But it already is marked (see code). I already searched but none of the solutions i…
Simon Wa
  • 33
  • 5
1
vote
0 answers

DataMember return null

I use SoapUI to test my web service. The point is that is not taking the value of some tag, i.e, Smith John I don't know reason but alway DataMember…
beto13
  • 49
  • 6
1
vote
1 answer

Parse JSON named array using C# DataContractJsonSerializer

How can I use DataContractJsonSerializer to parse a JSON array which does not have a fix name? Suppose a JSON Structure like this: { "SUMMARY": { "0123": [ { "Type": "Type_A", "Duration": 100 } ] } } In C#, I…
Alan Hung
  • 41
  • 1
1
vote
1 answer

Is it possible to use DataMember to overwrite serialized property value

I've been playing around with serializing objects and I'm wondering whether you can use the DataMember attribute to overwrite the serialized value based on a condition? For instance if I had this property on my class: [DataMember] public string Foo…
Stig Perez
  • 3,595
  • 4
  • 23
  • 36
1
vote
1 answer

WCF web service Data Members defaulting to null

I am new to WCF and created a simple REST service to accept an order object (series of strings from XML file), insert that data into a database, and then return an order object that contains the results. To test the service I created a small web…
James
  • 13
  • 1
  • 4
1
vote
1 answer

Serialization using DataContract in WebApi. one of the type is turned into null

I am sending XML using PUT to WebAPI to add record to my database. Each class has the [DataContract] attribute and its fields have a [DataMember] attribute. The reason for this that we don't want to expose the actual type name to the enduser. My…
1
vote
1 answer

Method or data member not found compile issue

I have a VB6 project that I didn't create but I have to update, when I go to make the exe I get a compile error: Method or data member not found, and it points too "SCom1.FileReceive" in the code below. When I look at the Main form, the SCom1…
Luk6e
  • 170
  • 2
  • 12