Update Database From Model error

Thread is closed for posting
2 posts, 1 answers
  1. Steve
    Steve avatar
    50 posts
    Member since:
    Apr 2013

    Posted 02 Jun 2013 Link to this post


    Update Database From Model (Create Database & Migrate Database) error, How to solved this problem? Please see screenshots.

    After Migrate Database

    After Create Database

  2. Answer
    Boris Georgiev
    Boris Georgiev avatar
    190 posts

    Posted 05 Jun 2013 Link to this post


    You cannot create a Primary Key constraint on a column which contains duplicated values. This operation is not an OpenAccess ORM limitation, it is not supported by the MS SQL Server. Telerik OpenAccess ORM cannot change the values in the column to allow the operation to be executed out of the box. To create a Primary Key constraint you have to make sure in the database that all the values in the chosen column are unique.

    For the second problem, the target database seems to have a table with the same name as the class you are mapping and you are trying to create it again. In case you would like to create a new database instead of updating the same one, please refer to this documentation article. If OpenAccess doesn't ask you to choose the target database explicitly, you have to change the connection string stored in your app.config or web.config file.
    On the other hand, if the database you would like to synchronize your model with does already exist, you can use the Migrate Database option.

    I hope that helps. 

    Boris Georgiev
    OpenAccess Samples Kit boasts 50+ sample applications providing diverse real-life business solutions. Click to read more and see OpenAccess ORM in action.
Back to Top