datacontract

DataContracts with behavior

半腔热情 提交于 2019-12-03 13:46:35
How bad is it? I have read countless articles and never created abstract DataContracts with behavior before, but it seems that doing so will solve an issue I am having that will prevent me from creating factories everywhere to determine a subclass implementation. My question is, will I be punished if I decide to add behavior to my data contracts? Of course they can't be consumed and are there to perform certain operations specific to that subclass type before invoking repository calls and data is persisted. I can create "Manager" classes for each subclass but that puts me back at factories and

Portable / Interoperable WCF Contracts

丶灬走出姿态 提交于 2019-12-03 12:38:38
问题 I was wondering if anybody out there had some good tips/dos and don'ts for designing WCF contracts with a mind for web-service interoperability, both in terms of older Microsoft web service technologies (e.g. WSE) and non-Microsoft technologies such as Java calling WCF web services. For example: are there any special rules that need to be taken into account when exposing DateTime as a type in your contract? How about Dictionaries and Hashtables? What are the issues you might run into with the

WCF Data Contract and Reference Entity Data?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-03 09:14:46
问题 Soliciting feedback/options/comments regarding a "best" pattern to use for reference data in my services. What do I mean by reference data? Let's use Northwind as an example. An Order is related to a Customer in the database. When I implement my Orders Service, in some cases I'll want the reference a "full" Customer from an Order and other cases when I just want a reference to the Customer (for example a Key/Value pair). For example, if I were doing a GetAllOrders(), I wouldn't want to return

Can I use DataContract and Serializable together?

此生再无相见时 提交于 2019-12-03 06:44:26
问题 I am working on WCF service. My all class are already serialize using [Serializable] attribute but due to "k__BackingField" Property Naming problem I used DataContract and DataMember attribute. so Can i use both attribute together like following: [Serializable] [DataContract] public class User { [DataMember] public string Name { get; set; } [DataMember] public int UserID { get; set; } } is this correct? I also got similar solution here. C# automatic property deserialization of JSON

WCF contract changes that affect clients

荒凉一梦 提交于 2019-12-03 05:17:41
问题 I was curious if someone could outline which types of WCF contract (interface) changes on the server side would break a client trying to send in a message, and why. I believe WCF can handle certain discrepancies, but I'm not sure exactly what you can change safely, and what you can't. Add/remove parameters from an OperationContract? Add/remove/change the DataContract's serialized properties? Add/remove OperationContracts from a ServiceContract? A friend asked a similar question here: Does

Portable / Interoperable WCF Contracts

血红的双手。 提交于 2019-12-03 03:52:26
I was wondering if anybody out there had some good tips/dos and don'ts for designing WCF contracts with a mind for web-service interoperability, both in terms of older Microsoft web service technologies (e.g. WSE) and non-Microsoft technologies such as Java calling WCF web services. For example: are there any special rules that need to be taken into account when exposing DateTime as a type in your contract? How about Dictionaries and Hashtables? What are the issues you might run into with the various bindings available? WCF DateTime woes Regarding your DateTime question, you are right to be

WCF Data Contract and Reference Entity Data?

霸气de小男生 提交于 2019-12-03 00:49:39
Soliciting feedback/options/comments regarding a "best" pattern to use for reference data in my services. What do I mean by reference data? Let's use Northwind as an example. An Order is related to a Customer in the database. When I implement my Orders Service, in some cases I'll want the reference a "full" Customer from an Order and other cases when I just want a reference to the Customer (for example a Key/Value pair). For example, if I were doing a GetAllOrders(), I wouldn't want to return a fully filled out Order, I'd want to return a lightweight version of an Order with only reference

Can I use DataContract and Serializable together?

北慕城南 提交于 2019-12-02 20:23:19
I am working on WCF service. My all class are already serialize using [Serializable] attribute but due to "k__BackingField" Property Naming problem I used DataContract and DataMember attribute. so Can i use both attribute together like following: [Serializable] [DataContract] public class User { [DataMember] public string Name { get; set; } [DataMember] public int UserID { get; set; } } is this correct? I also got similar solution here. C# automatic property deserialization of JSON Serializable and DataContract (not versus?) I found an article on MSDN according to this we can use both

WCF contract changes that affect clients

夙愿已清 提交于 2019-12-02 18:34:21
I was curious if someone could outline which types of WCF contract (interface) changes on the server side would break a client trying to send in a message, and why. I believe WCF can handle certain discrepancies, but I'm not sure exactly what you can change safely, and what you can't. Add/remove parameters from an OperationContract? Add/remove/change the DataContract's serialized properties? Add/remove OperationContracts from a ServiceContract? A friend asked a similar question here: Does adding a method to a WCF ServiceContract break existing clients? EDIT: As John Saunders pointed out,

Returning XmlDocument from WCF service not working

牧云@^-^@ 提交于 2019-12-02 10:31:50
I am trying to update some WCF service methods that return strings to return XmlDocument objects. I've tried returning it as-is and encapsulating it in a datacontract object. Either way I'm hitting an error upon attempting to update the service reference. The error suggest encapsulating it in a datacontract with an operations contract which I am doing. Is there a trick to this? There's a way to return a XmlDocument from WCF, but you need to use the XmlSerializer instead of the default serializer ( DataContractSerialier ) - the code below shows how it can be done. Having said that, do consider