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

Autocreate Database if not Existing using Model - First Mapping

1 Answer 37 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.
Jed
Top achievements
Rank 1
Jed asked on 05 Sep 2014, 08:31 AM
Good day,

I'm having a problem here. Can you help me, how to automatically create database, tables, and schema if it does not exist? like it does not exist on MYSQL, (which is I am using), and when I run the program, it'll auto create the database and everything. 

Thank you.

1 Answer, 1 is accepted

Sort by
0
Boris Georgiev
Telerik team
answered on 10 Sep 2014, 08:43 AM
Hello Jed,

Telerik Data Access supports Data Definition Language which allows you to create or delete a database instance based on the connection string. To achieve this, OpenAccesContext exposes a method GetSchemaHandler() which returns a Schema Handler Instance. For more information about the Schema Handler instance please refer to this article.

In the bottom of this article you can find an example how to Create a new database if it is not existing or to update the database with the latest changes from the model.

I hope that helps.

Regards,
Boris Georgiev
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
Jed
Top achievements
Rank 1
Answers by
Boris Georgiev
Telerik team
Share this question
or