datamember

.NET base type cannot be serialized by WCF

I'm writing a WCF service and want to expose some custom configuration elements (e.g. Custom ConfigurationSection and ConnectionStringSettings) so that I can modify the service's configuration. One of my custom configuration elements inherits from System.Configuration.ConfigurationElementCollection. When I try to start my WCF service I g...

WCF DataContract/ServiceOperation involving .NET XmlDocument type

hi all, im just wondering about data contracts to be sent over the wire in WCF communication. i know for the sake of interoperability it is not advisable (maybe not even allowed?) to send native .NET types as part of a data contract. I wish to have a service which accepts, as an input to a ServiceOperation, a .NET XmlDocument type. If ...

OCaml data members without initialization

I would like to create an object with a data member using OCaml but do not necessarily want to specify an initial value for the data member. Many examples seem to use a list but I would like to use a single instance of an object type I've created. Is this possible? Thanks. class bar = object end;; class foo = object (self) val myDataMe...

How can we use a DataMember of a DataContract in silverlight

I am creating an application in which i made a WCF service and now a DataContract Class which have some DataMebers in the ServiceContract I am using that DataContract Class No I am able to access the operationContracts but now I want to access the DataMember of the DataContract Class in the silverligh XAML.CS page Please Suggest How ...

Custom datacontract / datamember name

Hello, I have a following problem. A customer requested a web service that returns data in following format: <status> <name1>Some name</name1> ... </status> But when an error occurs they want to get a following message: <status> <error>Error description</error> </status> I created a web service using WCF and in order to fulfill ...

WCF - Sub-class added to a [DataMember] List<BaseClass> causes exception

One of my [DataContract] classes contains a [DataMember] which is a List. BaseClass has a few different sub-classes. Whenever that List contains instances of any sub-class, an exception occurs during/after the Service is returning to the request channel. If the List does not contain any sub-classes, it works fine. Here is an example of...

Does C# resolve dependencies amongy static data member automatically?

If one static data member depends on another static data member, does C#/.NET guarantee the depended static member is initialized before the dependent member? For example, we have one class like below class Foo { public static string a = "abc"; public static string b = Foo.a + "def"; } When Foo.b is accessed, is it always "abcdef"...

WCF DataMember Serializing questions

Ok, so I was part way through the long winded process of creating DTOs for sending my model over the wire and I don't feel like I'm going down the right route. My issue is that most of the entities in my model are not much more that DTOs anyway. I basically have an anaemic domain model, which is fine but it also make me wonder if I nee...

WCF: Exposing readonly DataMember properties without set?

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 unable to do so because it doesn't seem that I'm allowed to add a [DataMember] property without having both get and set. So - is there a way to ...

WCF Read DataMember Name attribute.

Hi Guys I have a very simple class called person. public class Person{ [DataMember(Name="MyName")] public string Name { get;set;} } If I try to serialize or de-serialize, everything works great. In the XML I can see a tag called "MyName" and in the object I see with the VS Intellisense a property called Name. What I need now is ...

.Net Represent xml in class without xsd

How would I represent something like this <product> <sku>12452</sku> <attribute name="details">good stuff</attribute> <attribute name="qty">5</attribute> </product> for use in my WCF service? Not sure how to define the multiple attributes whose only difference is the "name". I need this properly setup as a DataMember so xml ...

Selective serialization with NetDataContractSerializer

Serializing this class works fine. However, sometimes I'd like to exclude the field. Is this possible? [DataContract] class Foo { [DataMember] Foo _Foo; } Setting the field to null temporarily is impossible. ...

Sending a Tuple object over WCF?

Is the System.Tuple class supported by WCF's Data Contract Serializer (i.e., can I pass Tuple objects to WCF calls and/or receive them as part or all of the result)? I found this page, but not the clear, definitive "you can send and receive Tuples with WCF" answer I was hoping for. I'm guessing that you can, as long as all of the type...

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 project and send over a stream created from an xml doc. The problem is that even though all...

Define data members within constructor

I have got this little snippet of code, I want to be able to define each array element as a new data member. class Core_User { protected $data_members = array( 'id' => '%d', 'email' => '"%s"', 'password' => '"%s"', 'title' => '"%s"', 'first_...

Is it necessary to declare attribute [DataMember(Order=n)] on public method?

In my solution, I have created public class to store value and already declare [DataContract/DataMember] attribute. For example, [DataContract] public class MeterSizeInfo { string _meterSizeId; [DataMember(Order = 1)] public string MeterSizeId { get { return this._meterSizeId; } set { this._meterSizeId ...

ArgumentException was unhandled Application.run

Hi I've been through many sites and can't seem to find an answer. I modified a view that was connected to a Datagridview connected through a tableadapter on a C# Winforms app and in order to "reconnect" I had to delete the tableadapter and reconnect it. This was to get rid of an error regarding Unique contstraints. So I fixed that and...

Can I prevent a specific datamember from being deserialized?

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 prevent DM2 from being deserialized when being returned from an OperationContract. Something like this: [OperationContact] pu...

Asmx web service JSon response doesn't take into account DataMember(Name =

Hi, I can't manage to get a proper json response in an asmx web service. Data structure are defined with DataContract and DataMember attribute but specifying DataMember Name doesn't change response data. Do you have any idea? Here the code (it's for jqgrid): /// <summary> /// a row of the jquery table /// </summary>...

VB .NET : DataGridView.DataMember throws error when assigned a two-part name. i.e. Sales.StoreContact

My problem is oulined here: http://support.microsoft.com/kb/314043 Microsoft says: "This behavior is by design." No workaround is provided. I need a workaround. So I have a dataset which is populated correctly with the contents of the table name Sales.StoreContact. When I try DataGridView1.DataMember="Sales.SalesContact" the IDE th...