Database First DisplayName Annotations

2 posts, 0 answers
  1. Adam
    Adam avatar
    1 posts
    Member since:
    May 2013

    Posted 24 May 2013 Link to this post

    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!
  2. Dimitar Tachev
    Admin
    Dimitar Tachev avatar
    67 posts

    Posted 29 May 2013 Link to this post

    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.
  3. DevCraft banner
Back to Top