I've been using WCF's DataContract and DataContractSerializer to read/write objects to XML files. We want to switch to using a Ruby on Rails version, and I wanted to find out what I could use. We have objects that have attributes like (these are just examples not the exact objects):
[DataContract]
public class City
{
[DataMember]
...
We have a service reference that points at a WCF service, this acts as a proxy to our model layer where our data access logic is being handled. Under the hood we are using Linq2Sql as the ORM to facilitate the database communication.
We use the generated classes as our data access layer, but what gets returned is actually dumb DTOs obje...
Is there anyway to stick objects which are decorated with DataContract attributes but not decorated with Serializable attributes in to a SqlServer StateServer? In other words, I would prefer not having to decorate these objects with the Serializable attribute as I will also have to implement IXmlSerizable on all of these objects because ...
Hi,
I am using calling web services and using WCF generated service-reference on the client. I have saved XML responses that are received from test service to disk (without SOAP envelope and body tags) I would like to load them from disk and create objects from them. Lets' take the following method from my web service:
SomeMethodRespo...
Problem:
I have a WCF service setup to be an endpoint for a call from an external system. The call is sending plain xml. I am testing the system by sending calls into the service from Fiddler using the RequestBuilder.
The issue is that all of my fields are being deserialized with the exception of two fields. price_retail and price_whol...
I have an XML file that I'm trying to serialize into an object. Some elements are being ignored.
My XML File:
<?xml version="1.0" encoding="utf-8" ?>
<License xmlns="http://schemas.datacontract.org/2004/07/MyApp.Domain">
<Guid>7FF07F74-CD5F-4369-8FC7-9BF50274A8E8</Guid>
<Url>http://www.gmail.com</Url>
<ValidKey>true</Valid...
I think i already know the answer to this, but i cannot find anything that states it definitively, hence my question - i want to make sure i am not missing a trick.
Using the DataContractSerializer or the XmlSerializer, is there any way to change what a pulic property is serialized as? I have a property that is an Enum, and i would lik...
I understand how XMLSerializer could work by using reflection to figure out what public read/write fields or properties it should be using to serialize or de-serialize XML. Yet XMLSerializer requires that the fields be public and read/write.
However, DataContractSerializer is able to read or write to or from completely private fields i...
I read some microsoft articles.They explained that WCF uses DataContractSerializer for serialization.But the articles did not explain why DataContractSerializer preferred over
XmlSerialization.Can anyone give me the additional information?
...
Good Day Everyone...
My understanding may be wrong, but I thought once you applied the correct attributes the DataContractSerializer would render fully-qualified instances back to the caller.
The code runs and the objects return. But oddly enough, once I look at the returned objects I noticed the namespacing disappeared and the object-...
I have a List which is populated with objects of various concrete types which subclass BaseType
I am using the WCF DataContractSerializer
<Children>
<BaseType xmlns:d3p1="http://schemas.datacontract.org/2004/07/Tasks"
i:type="d3p1:ConcreteTypeA"></BaseType>
<BaseType xmlns:d3p1="http://schemas.datacontract.org/200...
I am migrating to wcf and trying to figure out how I'm going to declare my Data Contracts properly. Some of the types I have been remoting are from a third party that I am unable to change. Are attributes the only way to explicitly declare data contracts in wcf? I know about the auto data contract functionality in 3.5, but the books I'...
I'm writing an app that allows users search and browse catalogs of widgets. My WidgetCatalog class is serialized and deserialized to and from XML files using DataContractSerializer. My app is working now but I think I can make the code a lot more efficient if I started taking advantage of data binding rather then doing everything manuall...
I have an Aspect that implements INotifyPropertyChanged on a class. The aspect includes the following:
[OnLocationSetValueAdvice, MethodPointcut("SelectProperties")]
public void OnPropertySet(LocationInterceptionArgs args)
{
var currentValue = args.GetCurrentValue();
bool alreadyEqual = (currentValue == args...
If I am serializing and later deserializing a class using DataContractSerializer how can I control the initial values of properties that were not serialized?
Consider the Person class below. Its data contract is set to serialize the FirstName and LastName properties but not the IsNew property. I want IsNew to initialize to TRUE whether ...
dataElementsList : TypesAndData.DataElement list
is a list of 50,000 records (actually many more but let's start small). I am trying to serialize to a JSON file:
let ser = Json.DataContractJsonSerializer(typeof<TypesAndData.DataElement list>)
use ofs = File.OpenWrite(fileName)
let result = ser.WriteObject(ofs, dataElementsList)
an...
Is there a way to make the DataContractSerializer serialize a [MessageContract] the same way it appears when transmitted over SOAP?
I have a class that appears as follows on the wire for a WCF call:
<TestRequest xmlns="http://webservices.test.com/ServiceTest/1.1">
<Name>Just Me</Name>
</TestRequest>
When serializing using the DCS...
Hey Stackoverflowers :)
For our Silverlight Project (SL4) I'm using a Model which might contain Lists (IList<AnotherModel>). According to good practice and rule CA2227:CollectionPropertiesShouldBeReadOnly
the IList properties don't have a public setter. We serialize the Model using the DataContractSerializer which is working. But when ...
I am new to WCF and have a simple question...
My DataContract class returns an Enum type to the consumer from one of it's exposed methods.
The consumer is able to see the enum type, and instantiate variables of that typel.
However, I have not provided a [DataContract] nor [EnumMember]s for the enum in the service.
My question is, wh...
I have a class which contains a list of items.
I want to serialize an instance of this class to json using the DataContractJsonSerializer as a json array. eg.
class MyClass
{
List<MyItem> _items;
}
class MyItem
{
public string Name {get;set;}
public string Description {get;set;}
}
When serialized to json it should be like...