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

db column naming ???

2 Answers 93 Views
Databases and Data Types
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
SelAromDotNet
Top achievements
Rank 2
SelAromDotNet asked on 11 Feb 2009, 03:23 AM
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 Answers, 1 is accepted

Sort by
0
PetarP
Telerik team
answered on 11 Feb 2009, 12:39 PM
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.
0
SelAromDotNet
Top achievements
Rank 2
answered on 11 Feb 2009, 02:49 PM
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!
Tags
Databases and Data Types
Asked by
SelAromDotNet
Top achievements
Rank 2
Answers by
PetarP
Telerik team
SelAromDotNet
Top achievements
Rank 2
Share this question
or