LinqConnect Documentation
Devart.Data.Linq Namespace / DataContext Class / CreateDatabase Method / CreateDatabase() Method

In This Topic
    CreateDatabase() Method
    In This Topic
    Creates and executes script that creates database tables with their constraints, indexes, and foreign keys.
    Syntax
    'Declaration
     
    Public Overloads Sub CreateDatabase() 
    public void CreateDatabase()
    Remarks

    The database or schema is not created, an existing one is filled. The name of the database is derived by using the following algorithm:

    • If a database is identified in the connection string, its name is used.
    • If a DatabaseAttribute attribute is present, its Name property is used as the name of the database.
    • If there is no database tag in the connection string and a strongly typed DataContext is used, a database that has the same name as the DataContext inheriting class is checked.
    • If a weakly typed DataContext is used, an exception is thrown.
    • If the DataContext has been created by using a file name, the database corresponding to that file name is created.
    Requirements

    Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

    See Also