How can we specify the string length in OpenAccess

Thread is closed for posting
2 posts, 0 answers
  1. Håkan
    Håkan avatar
    29 posts
    Member since:
    Apr 2012

    Posted 05 Aug 2012 Link to this post

    Hi All,

    How can we specify the string length in OpenAccess.

    We create a class  as follows

    using System.ComponentModel.DataAnnotations;

    namespace Crowdlogistics.Party.Domain



        public class PartyRelationShipType


            public int RelationshipTypeID { get; set; }

            public string RelationshipType { get; set; }


            public string CreatedBy { get; set; }

            public DateTime CreatedOn { get; set; }


            public string UpdatedBy { get; set; }

            public DateTime UpdatedOn { get; set; }



    But string length was not taken in DB. How can we do this.

    Development Team.

  2. Viktor Zhivkov
    Viktor Zhivkov avatar
    324 posts

    Posted 08 Aug 2012 Link to this post


    You can specify the length of a string property by two ways:
    1. Using Table Editor - provide a value in the numeric up down control for Precision for the target column. You can find more information about Table Editor on this page.
    2. Using Fluent Mapping - setting HasLenght property to the desired value as described in this article.
    The data annotation attribute that you are using will not help you achieve your goals in this case. It will add the specified string length in the metadata associated with a WCF Plain or Data Service, but not with the OpenAccess data model.

    If you have any additional questions do not hesitate to contacts us again.

    All the best,
    Viktor Zhivkov
    the Telerik team
    OpenAccess ORM Q2'12 Now Available! Get your hands on all the new stuff.
Back to Top