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

Can read from DB?

1 Answer 61 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.
Jonathan
Top achievements
Rank 1
Jonathan asked on 26 Jul 2014, 12:09 PM
I created a telerik web application and built my models from an existing database but I cant selelct from it as I get the following error

Both types, 'DMSv1Model.Right','DMSv1Model.Right', participating in a bi-directional association use a server side key generator. This is an invalid setup.

heres my code

User _NewUser = new User();

            try
            {
                using (EntitiesModel dbContext = new EntitiesModel())
                {
                    _NewUser = (from u in dbContext.Users
                                where u.UsrUserName == userName
                                select u).FirstOrDefault();
                    return _NewUser;
                }
            }
            catch (Exception ex)
            {
                //Rethow like this in order preservce stack trace
                throw;
            }

1 Answer, 1 is accepted

Sort by
0
Ady
Telerik team
answered on 30 Jul 2014, 02:13 PM
Hello Jonathon,

 DataAccess seems to have detected a 1-1 relationship between the same table and hence complains that both sides of a 1-1 relationship cannot have a server side generated primary key. It seems a column in the table is referencing another column in the same table. What kind of a relationship do you want to represent?

The provided link describes how to map a 1-1 association using the Fluent API. Can you provide some more information about your database schema and maybe also provide me your rlinq file?

Regards,
Ady
Telerik
 
OpenAccess ORM is now Telerik Data Access. For more information on the new names, please, check out the Telerik Product Map.
 
Tags
Data Access Free Edition
Asked by
Jonathan
Top achievements
Rank 1
Answers by
Ady
Telerik team
Share this question
or