Can read from DB?

2 posts, 0 answers
  1. Jonathan
    Jonathan avatar
    1 posts
    Member since:
    Jul 2014

    Posted 26 Jul 2014 Link to this post

    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;
                }
  2. Ady
    Admin
    Ady avatar
    589 posts

    Posted 30 Jul 2014 Link to this post

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