db column naming ???

3 posts, 0 answers
  1. SelAromDotNet
    SelAromDotNet avatar
    67 posts
    Member since:
    Jul 2012

    Posted 10 Feb 2009 Link to this post

    I just got started with openaccess. i see its potential! however, I am stuck on the forward mapping. I cannot get my database names to match my field names. I have a class called Twitters:

        [Telerik.OpenAccess.Persistent(IdentityField="id")]  
        public class Twitters  
        {  
            private string id;  
            public string ID { get { return id; } set { id = value; } }  
            public string Description { getset; }  
            public char Type { getset; }  
        } 

    when I run the db tool, however, the field names look like this:

    <_dscription>k___backing_field
    <_type>k___backing_field
    id

    only id came out correctly. in the videos I've seen, the forward mapping generates db tables and columns that exactly match the fields from the class. I realize this probably isn't necessary for the functionality of the system, but what am I doing wrong?
  2. PetarP
    Admin
    PetarP avatar
    754 posts

    Posted 11 Feb 2009 Link to this post

    Hi Josh,

    Currently Telerik OpenAcess ORM does not support auto-properties only. In order to get your columns named right you will have to create a private fields for description and type just as you did for id.
    [Telerik.OpenAccess.Persistent(IdentityField = "id")] 
            public class Twitters 
            { 
                private string id; 
                public string Id 
                { 
                    get { return id; } 
                    set { id = value; } 
                } 
     
                private string description; 
     
                public string Description 
                { 
                    get { return description; } 
                    set { description = value; } 
                } 
     
                private char type; 
     
                public char Type 
                { 
                    get { return type; } 
                    set { type = value; } 
                } 
     
            } 

    Be aware that the word Type is key word and thus your field in the database will be generated with the name "typ".

    All the best,
    PetarP
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. DevCraft banner
  4. SelAromDotNet
    SelAromDotNet avatar
    67 posts
    Member since:
    Jul 2012

    Posted 11 Feb 2009 Link to this post

    wow I don't know why I never thought of that. the id is the one that worked, the id is the one I separated. duhhhh

    thanks for your help!
Back to Top