Hi,
Im trying to consume a WCF service in silverlight...
What I have done is to create two seperate assemblies for my datacontracts...
Assembly that contains all of my types marked with data contracts build against .Net 3.5
A Silverlight assembly which links to files in the 1st assembly.
This means my .Net app can reference assembl...
I have created a number of WCF Services, for arguments sake they are called Service1 and Service2.
Both of the services return (at some point, possibly through a relationship inside an object) a Customer object.
For testing sake, I have added a GetCustomer() method to both Service1 and Service2 and I have added a service reference to b...
I asked a question about deserializing based on an attribute with data contracts. Apparently this isnt possible so I have to convert my DataContract to use XmlElement's (see http://stackoverflow.com/questions/2177079/net-represent-xml-in-class-without-xsd)
I'm assuming datacontracts cannot intermingle with xmlelements. How can I define...
I have a base class like the following:
[Serializable]
public class SerializableDomainObject<T>
{
public SerializableDomainObject()
{
ID = Guid.NewGuid();
}
[DataMember(Name="ID", Order = 0)]
public Guid ID { get; private set; }
public void Save()
{
// serialize
}
public void Load()...
I want to be able to Generate WCF C# DataContract from 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 items?
Or is there a better approach? I am trying to avoid having to recreate the Data Contract each time the XSD file is changed and regen...
I have the following model:
public class ABaseObject
{
private Guid id = Guid.NewGuid();
public ABaseObject()
{
}
public Guid ID { get { return id; } }
}
public class ADerivedObject : ABaseObject
{
public ADerivedObject()
{
}
public string Name { get; set; }
}
public class AObjectCollection<T>
{
...
Given the fact that I have a fully dynamic object model, that is, I have no concrete classes defined anywhere in code, but I still want to be able to create WCF DataContracts for them so I can use them in operations. How can I achieve this?
My concrete class "Entity" implements ICustomTypeDescriptor which is used to present the various ...
I have two WCF services which are logically different and I wish to keep them seperate. They each have an operation which returns the same datacontract. A single silverlight client consumes both services. When I add a service reference in the silverlight client to each service, the single datacontract ends up twice in the generated co...
I have a WCF service method that expects an object and then retrieves its properties using reflection.
On the client side I create an anonymous type object
var obj = new {FirstName="John", LastName="Doe"}
and pass it to the method. I'm getting an exception:
Type '<>f__AnonymousType0`2[System.String,System.String]' cannot be serial...
I am building a set of WCF services that share common data contracts (or entities if you prefer). These are simple data transfer objects that are decorated with DataContract and DataMember attributes. I am explicitly specifying the name and namespace. In trying to follow the principles of IDesign's recommendation of averaging 12 members ...
XmlSerialization creates a serializer proxy for each class. The proxy resides in a different assembly so it can serialize only public fields.
DataContract serialization can serialize private fields too. Does it mean it uses reflection? Isn't it slower than using a proxy (except for the first time)?
...
I have been writing web services for about a year now and it seems that the process I use to get data from the Database all the way to display to the user and back again has some inefficiencies.
The purpose of this question is to make sure that I am following best practices and not just adding extra work in.
Here is the path for data ...
While using for an object this code to serialize it:
public object Clone()
{
var serializer = new DataContractSerializer(GetType());
using (var ms = new System.IO.MemoryStream())
{
serializer.WriteObject(ms, this);
ms.Position = 0;
return serializer.ReadObject(ms);
...
hi, i have a general design question.
we have a fairly big data model that represents an clinical object, the object itself has 200+ child attributes in the hierarchy.
and we have a SetObject operation, and a GetObject operation. my question is, best practice wise, would it make sense to use that single data model in both operations o...
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 classes as
[DataContract]
class Bar<T> : Foo
{ ... }
To get this to work, I'd previously have to register KnownTypes for the Foo class, and...
Hi all,
I have a class that I need to be able to serialize to a SQLServer session variable and be available over a WCF Service. I have declared it as follows
namespace MyNM
{
[Serializable]
[DataContract(Name = "Foo", Namespace = "http://www.mydomain.co.uk")]
public class Foo : IEntity, ISafeCopy<Foo>
{
[DataMember(Order = 0)]
...
I want to be able to query my database over the web, and I am wanting to use a WCF service to handle the requests and results. The problem is that due to the amount of data that can potentially be returned from these queries, I'm worried about how these results will be serialised over the network. For example, I can imagine the XML seria...
Hi,
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 returns it and never recieves it as an argument.
If I try to define only getters on properties I get a run time error. I guess this is b...
I have a simple WCF service that returns the time from the server. I've confirmed that data is being sent by checking with Fiddler. Here's the result object xml that my service sends.
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<GetTimeResponse xmlns="http://tempuri.org/">
...
I would expect a Dictionary object of the form:
var dict = new Dictionary<string,string>()
{
{"blah", "bob"},
{"blahagain", "bob"}
};
to serialize into JSON in the form of:
{ "blah": "bob", "blahagain": "bob" }
NOT
[ { "key": "blah", "value": "bob" }, { "key": "blahagain", "value": "bob"}]
What is the reason for what app...