Data annotations on WCF service contracts -
I have a WCF service in which the [DataContract] class is defined in it. Each property has a [datamember] attribute and I've added data entry attributes [required] and [stringlence] for some dual properties.
I then use this service in an asp. Pure MVC application as service reference. When I get a list of all types of features
var attr = to type dyscriptor Support in GateProperties (example) Cost & lt; PropertyDescriptor & gt; () Prop.Attributes.OfType & lt; ValidationAttribute & gt; () Select attribute; I think no data annotation has come. Is it a limit of WCF or am I doing something wrong here by default?
Properties will not be sorted when your data is sent on contract wire New feature Is created in Meta Data, which is associated with property and in that type the property is not related and will not be available.
I think that you have added a service reference in your ASP.NET mvc application, unless specified, create a new proxy class that represents your data contract
When you add a service reference, when you click on the Advanced button, make sure 'Use existing types' is checked. Ensure that your service will use your existing contract.
This can not be the best practice, because the client application must have knowledge about the type of service you are returning from the service, it can be fine if your service is used only by you, You have to add the contract reference to your asp.net net MVC application.
Comments
Post a Comment