This is a migrated thread and some comments may be shown as answers.

Database First DisplayName Annotations

1 Answer 84 Views
Data Access Free Edition
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Adam
Top achievements
Rank 1
Adam asked on 24 May 2013, 01:43 PM
So, am I just really thick or can I not seem to find any reference to being able to add DisplayName annotations to the rlinq files?  Is there something obvious I'm overlooking in the product and the documentation somewhere?

Otherwise, love the product!  Thanks!

1 Answer, 1 is accepted

Sort by
0
Dimitar Tachev
Telerik team
answered on 29 May 2013, 08:30 AM
Hello Adam,

 
We are currently implementing out of the box generation for some of the Data Annotation attributes for the properties of the Domain Classes and they will be available in the next official release (Q2 2013) which is expected in June.

The supported attributes will be Required, Key, StringLength and DataType. They will be calculated base on their columns in the database - for example if you have a currency column you will get a DataType.Currency applied on its corresponding property.

Regarding to the DisplayName attribute - we are planning to implement "Add custom attributes" functionality for each of the properties of your entities but it is not scheduled yet and I cannot give you a time frame for this feature. 

This feature request from our Ideas and Feedback portal is describing this scenario. There you can vote for the item which will raise its priority in our product backlog.

Until then the recommended approach for adding attributes to the properties of your domain classes is by creating a partial class in a separated file and settings the attributes using a buddy class.

Please find an example of a buddy class below:

[MetadataTypeAttribute(typeof(Category.CategoryMetadata))]
public partial class Category
{
    internal sealed class CategoryMetadata
    {
        private CategoryMetadata()
        {
        }          
         
    [DisplayName("ID")]
        public System.Int32 CategoryID { get; set; }
 
           [DisplayName("Name")]
        public System.String CategoryName { get; set; }
    }
}

I hope this is applicable for you. Do not hesitate to contact us back if you have any further questions.

Regards,
Dimitar Tachev
Telerik
OpenAccess Samples Kit boasts 50+ sample applications providing diverse real-life business solutions. Click to read more and see OpenAccess ORM in action.
Tags
Data Access Free Edition
Asked by
Adam
Top achievements
Rank 1
Answers by
Dimitar Tachev
Telerik team
Share this question
or