Questions tagged [datacontracts]

36 questions
7
votes
3 answers

Should I test all enum values in a contract?

I have a doubt about about whether I should consider a certain type of test functional or contract. Let's say I have an API like /getToolType, that accepts a {object" "myObject"} as input, and returns at type in the form {type: "[a-z]+"} It was…
rrabio
  • 143
  • 2
  • 6
4
votes
2 answers

Service contracts vs. domain objects

Say I have two interfaces to my application: A web front-end A back-end which provides data Both of them talk to a web-service, and that web-service in turn, handles business logic and talks to a separate data layer, which persists the…
Jonathan
  • 32,202
  • 38
  • 137
  • 208
3
votes
2 answers

WCF Serialization Information outside class definition

Suppose this simple scenario: My client has an already working .net application and he/she wants to expose some functionality through WCF. So he gives me an assembly, containg a public class that exposes the followig method. OrderDetail…
3
votes
4 answers

Wcf datacontract for classes in a library which i cannot modify

hi i have a class library that which performs methods and has a lot of different classes which it uses as parameters for the methods calls... i am creating a wcf wrapper for this class library. but I do not have permission to change the class…
Prakash
  • 471
  • 1
  • 8
  • 19
3
votes
3 answers

C# WCF data contract partial class - new field in 2nd partial class not being picked up

I have a WCF service in which I have some data contracts. I'm using web service software factory, which uses a designer to create all the message and data and other contracts, and it creates them as partial classes. When the code is regenerated the…
Ciarán Bruen
  • 5,221
  • 13
  • 59
  • 69
3
votes
1 answer

How to replace DataContractResolver in Web Api stack?

There are a lof of different ways to replace the DataContractResolver if you are using WCF, I want to do the same thing with the Web Api. The only extension point I've found is…
Marius
  • 9,208
  • 8
  • 50
  • 73
2
votes
1 answer

How to specify a generic Type parameter in XSD Data Contract?

I have the following Request and Response Data Contract pair for a Webservice method call
NZJames
  • 4,963
  • 15
  • 50
  • 100
2
votes
2 answers

WCF - contracts versioning (by example)

This should be easy for someone familiar with the best practices of versioning service/data contracts. I want to make sure that I will use this versioning in the correct way. So, let's say we have a service…
Learner
  • 3,297
  • 4
  • 37
  • 62
2
votes
1 answer

JSON.net not including null properties with EmitDefaultValue false

I have a system with many data contracts where the members are decorated with: [DataMember(EmitDefaultValue = false)] I have a case where I need the members to be included when null when serialized to JSON. No matter what serializer settings I…
twifosp
  • 277
  • 2
  • 7
  • 16
2
votes
1 answer

RIA DomainService not generating client code using DataContracts

I'm working on a Silverlight 4.0 application and am using RIA services. I have created a class on the server-side which has DataContract and DataMember attributes applied to it. A DomainService exposes this class as a query result and as such,…
JeroenNL
  • 203
  • 2
  • 9
2
votes
1 answer

Is there any way to hide/flatten base types in WCF service data contracts?

Consider the following simple example: [DataContract("{0}Base")] public class Base where T : Entity { // Common methods & properties. No WCF exposed properties } [DataContract] public class Employee : Base { // WCF exposed…
WayneC
  • 2,530
  • 3
  • 31
  • 44
2
votes
2 answers

Is it correct to directly accept values from the data access layer into the data contracts?

I have a question on the correct way to assign values obtained from the database in the data access layer to the data contracts at the WCF layer. Consider a simple scenario in which to get a list of all students from the database and then assign it…
user1953684
  • 59
  • 1
  • 5
1
vote
0 answers

How to resolve an error with WCF data contract -Message = "There was an error while trying to serialize parameter

I have two data contracts of same contents in two different namespaces. i have copied one datacontract to another and passed to a particular method. but it is giving the below error and throwing exception. it is not going into that method. Please…
Sudhakar
  • 93
  • 3
  • 9
1
vote
1 answer

Sharing Collection Data Contracts

I have some WCF services and have separated out the data contracts for these services into their own assembly. I then have a client of the services that references the data contracts assembly. I have turned on the option to Reuse types in referenced…
Kent Boogaart
  • 175,602
  • 35
  • 392
  • 393
1
vote
1 answer

WCF : namespace of datamember different than parent

We have to implement a provided external API. This API cannot be changed. For this API, SOAP messages are exchanged, and one of them dealing with fault exception is like that :
1
2 3