Is it possible to create a WCF service that can pass custom attributes of an object?
For instance, on one of my properties in the object I am passing, I have this custom attribute defined:
[DataMember(Name = "O_ID")] [Grid("Order ID",0)] public int O_ID { get { return o_id; } set { o_id = value; } }
I want to be able to reference the attribute class Grid on my client side. I am not sure if this is possible or not. If it is, how would I accomplish this?
This is not possible by default. The DataContractSerializer simply would not understand this and have no way to express it in schema.
It is possible to switch and use the NetDataContractSerializer in WCF which effectively shares type instead of schema but this may cause other problems such as the compaitbiltiy of your services with non-.net consumers.
If all your consumers will be .net then you could try this. There are some posts about how to swicth serializers here :