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

Order columns/properties in model

1 Answer 78 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.
uquandux
Top achievements
Rank 1
uquandux asked on 14 Nov 2012, 08:34 AM
Hello everyone,

I created my database-model using model-first-approach. When creating the database
I noted that the columns in the .sql-files for creating the database were created in
alphabetical-order - which made my PrimaryKey (Id) appear somewhere in the middle
of the tables - and not as modeled in the diagram at the start.

Is there a way to order columns within the database-model (not alphabetical) and to
create the sql-scripts exactly in this order? Is it standard within the rlinq-file that
columns are ordered alphabetically in general? How to change?

Thanks in advance,
uquandux

1 Answer, 1 is accepted

Sort by
0
Dimitar Tachev
Telerik team
answered on 16 Nov 2012, 05:04 PM
Hi,

In general when you use model first scenario there are two options to change the order of the columns in your database model:

1) You could use our API for handling schema migrations programmatically to set the order of the columns in your database the same as the order in your domain model. The detail you should have in mind in this case is that if you have some associations between your tables you should also enable creation of foreign key constraints. For your convenience I created a sample application which illustrates that API - find it attached.

2) If you don’t want to use the order of the columns in your domain classes you could choose to update database from model wizard. At the summary page choose “Create Script File” instead of “Create Script File and Execute”. Then you could manually reorder the columns in the generated script file and execute it.

I will be happy to assist you if you have further questions.


Kind regards,
Dimitar Tachev
the Telerik team
Telerik OpenAccess ORM Meets ASP.NET Web API. Read more.
Tags
Data Access Free Edition
Asked by
uquandux
Top achievements
Rank 1
Answers by
Dimitar Tachev
Telerik team
Share this question
or