Autocreate Database if not Existing using Model - First Mapping

2 posts, 0 answers
  1. Jed
    Jed avatar
    2 posts
    Member since:
    Jul 2013

    Posted 05 Sep 2014 Link to this post

    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.
  2. Boris Georgiev
    Boris Georgiev avatar
    190 posts

    Posted 10 Sep 2014 Link to this post

    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.

    Boris Georgiev
    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