Reputation: 620
I have an entity with the following fields in the server side metadata class:
Partial Friend Class CustomerMetadata
<Required()> _
<Display(Order:=1, Name:="First Name")> _
Public Property FirstName As String
<Required()> _
<Display(Order:=2, Name:="Last Name")> _
Public Property LastName As String
<Required()> _
<Display(Order:=3, Description:="Phone")> _
Property DisplayPhone As String
<Required()> _
<Display(Order:=4, Name:="Email Address")> _
Public Property EmailAddress As String
End Class
Now in the client, I want to swap the display order of the Phone and Email address fields in a datagrid, so I create a new client side CustomerMetadata class like such:
Partial Friend Class CustomerMetadata
<Required()> _
<Display(Order:=4, Description:="Phone")> _
Property DisplayPhone As String
<Required()> _
<Display(Order:=3, Name:="Email Address")> _
Public Property EmailAddress As String
End Class
The client doesn't pick up the overridden display order. Any ideas on how to override the Display attribute in the client side metadata class?
Upvotes: 1
Views: 114
Reputation: 7049
It's not possible to override the metadata in the client that you set on the server.
In particular, the RIA Services concept of metadata classes is a server-side one - and only used when using Entity Framework with the model-first-approach where you have the designer create your entity classes). The attributes you put on the metadata classes on the server will be auto-generated during build as attributes on the actual entities on the client.
Since the ordering attributes are the only way I know of to control the DataGrid
ordering when using auto-generated columns, I can only think of two ways to evade the issue:
(For the sake of completion I should mention that you can also fiddle with the way RIA Services client code is auto-generated, but that would be inappropriate for the problem you're having.)
Upvotes: 2