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

schema updater

2 Answers 53 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.
amir sherafatian
Top achievements
Rank 1
amir sherafatian asked on 25 Aug 2009, 12:40 PM
how can i update my database schema after i add the artificial field ?
do i set schema update property to true in app.config or any where ?
is there any setting that i shoud do this ?

2 Answers, 1 is accepted

Sort by
0
IT-Als
Top achievements
Rank 1
answered on 25 Aug 2009, 01:17 PM
Hi amir,

It depends on how you structured your project.

If you have a class lib (assembly) containing the model (persistent classes) and another assembly (or main program) consuming this assembly, you should set the UpdateDatabase property of that project to true. It is set in VS for the properties of the project. Click on the project, go to the properties tab and there you'll find the UpdateDatabase.

Usually it is in the project, where the app.config file containing the connection information for OA resides.

/Henrik
0
PetarP
Telerik team
answered on 27 Aug 2009, 08:20 AM
Hi Henrik,

You can do that in both run-time and design-time.
If you would like to do this in design time then you should write your artificial fields by hand in the app.config file. Once you are done just set the UpdateDatabase to true and rebuild. This will automatically create the required ddl script and update the database.
If you would like to use this in runtime, you should apply your artificial fields using the XML approach and use this code:
ISchemaHandler schema = Database.Get("DatabaseConnection1").GetSchemaHandler(); 
            if(schema.CreateUpdateDDLScript(null)!=null
            schema.ExecuteDDLScript(schema.CreateUpdateDDLScript(null)); 
This will create a ddl script and execute it against the database.

Sincerely yours,
Petar
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Databases and Data Types
Asked by
amir sherafatian
Top achievements
Rank 1
Answers by
IT-Als
Top achievements
Rank 1
PetarP
Telerik team
Share this question
or