Page 1 of 1

Create MetadataType classes

Posted: Tue 10 Jul 2012 18:20
by mitchellj
Currently I am using MVC with a E.F model generated by DevArt using Entity Developer, one of the things I cannot see how to do easily is add DisplayName() attributes to classes.

I know in MVC you can provide a [MetadataType] to point to a different "holder class" which holds meta data details. I was just wondering if theres a "simple" way to do this in DevArt or if it's

1) Autocreate all partial classes then manually populate these classes by hand with the MetadataType tag and elemnts.

2) Edit the template and get it to do the heavy lifting.

Any help would be much appreciated.

Re: Create MetadataType classes

Posted: Thu 12 Jul 2012 16:24
by Shalex
mitchellj wrote:one of the things I cannot see how to do easily is add DisplayName() attributes to classes
You can do that in the following way:
1) right click on the diagram surface > Model Settings > Model | Attributes > Add | select the System.dll assembly from GAC and press OK. Then "Clear All" attributes and select only System.ComponentModel.DisplayNameAttribute and press OK. Now this attribute is available for all classes in your model.
2) select your class on the diagram or in Model Explorer and pres "..." against the Attributes property in the Properties window (F4). Add DisplayNameAttribute(String) to your class and set its "display Name".