Table of contents

    Database Addin

    The addin database consists of the following Addins:
    MonoDevelop.Database.ConnectionManager. This addin is responsible for connectivity, database explorer (Connection Manager Pad) and all nodes in a database (tables, procedures, functions, etc.).

    MonoDevelop.Database.Components. Common dialogs and widgets for the database addin.

    MonoDevelop.Database.Designer. Common Providers Operations Dialogs/Widgets: (Create Table, procedure, and others).

    MonoDevelop.Database.Query. Display Binding, Result view, Sql Query Text Editor.

    MonoDevelop.Database.Sql. This addin is the responsible for: Common schema, Query Services, Sql Factories, Connection Context Services, Abstract Connection Pool.

    Provider specific Addins: MonoDevelop.Database.Sql.* (MySql - Npgsql - Sqlite - Sql Server . Firebird - Oracle - Sybase - ODBC)

    Providers

    The available providers are:

    • MySql: MySql provider use a bundled Mysql.Data assembly [1] 
    • Npgsql.
    • Sqlite.
    • Sql Server.
    • Firebird: need a mantainer.
    • Oracle: need a mantainer.
    • Sybase: need a mantainer.
    • Odbc: need a mantainer.

    Features

    Connect to a database

    Create a database

    Drop Database

    Query Database

    Create / Alter / Drop Table

    Create/ Alter / Drop Procedures

    Query to Target

    Working with results

    Other features

    Developers

    Implementing a Provider 

     In order to implement a new provider you have to implement the following classes

    AbstractConnectionProvider[2] This class is the responsible of connection creation and check if a connection already exists.

    IDbFactory: [3] This is the main provider class, it expose all the objects needed for manage a Provider: Dialect, Gui Provider, Connection Provider, the connection pool creation and schema provider creation.

    IGuiProvider: [4] Expose all the GUI operations. Example: If a new addin provides Create Database operation, the method IGuiProvider.ShowCreateDatabaseDialog  (IDbFactory) is called. In this method it should be implemented the basic operations of creating a new Database, the Gui Dialog/Window.

    AbstractPooledDbConnection: [5] This represent a Pooled db connection (becareful, this doesn’t represent the pooling system, it only represent a connection. The pooling system should implement IConnectionPool or use DefaultConnectionPool class). All the database operations will be here: Execute a DataReader, Execute a DataTable, and others.

    AbstractEditSchemaProvider: [6] It expose the database operations as Creates, Drops, Alters and others database operations. This class, with IGuiProvider implements all the databases operations, the second implements the Gui part, and this implements the operations.

    Optional Implementations

    IDbLinq: [7] This represent the Linq generation interface, the connection between the provider and a generator (i.e.: sqlmetal).

    AbstractSqlDialect: [8] Expose dialect or provider specific techniques of generating Sql language. Currently isn’t really in use.

    Addin Manifest

    <Addin id="Database.Sql.ProviderName" namespace="MonoDevelop" name="Provider for MonoDevelop addin Sql" author="Your Name" copyright="MIT X11" url="http://www.monodevelop.com" description="Database Provider Module" category="Database" version="2.2">
    
      <Runtime>
        <!-- Your dll -->
        <Import assembly="MonoDevelop.Database.Sql.Provider.dll"/>
      </Runtime>
    
      <Localizer type="Gettext" catalog="monodevelop-database"/>
    
      <!-- Your Dependencies-->
      <Dependencies>
        <Addin id="Core" version="2.2"/>
        <Addin id="Core.Gui" version="2.2"/>
        <Addin id="Ide" version="2.2"/>
        <Addin id="Database.Sql" version="2.2"/>
        <Addin id="Database.Components" version="2.2"/>
        <Addin id="Database.Designer" version="2.2"/>
      </Dependencies>
    
      <!-- The implemented Factory-->
      <Extension path = "/MonoDevelop/Database/Sql">
        <DatabaseFactory id = "Provider" class = "MonoDevelop.Database.Sql.Provider.ProviderDbFactory" />
      </Extension>
    
      <!-- Syntax mode file (if it has)-->
      <Extension path = "/MonoDevelop/SourceEditor2/SyntaxModes">
        <Templates resource="ProviderSyntaxMode.xml" />
      </Extension>
    </Addin>
    

    References

    [1] http://dev.mysql.com/usingmysql/dotnet/
    [2] https://github.com/mono/monodevelop/blob/master/extras/MonoDevelop.Database/MonoDevelop.Database.Sql/Providers/AbstractConnectionProvider.cs
    [3] https://github.com/mono/monodevelop/blob/master/extras/MonoDevelop.Database/MonoDevelop.Database.Sql/IDbFactory.cs
    [4] https://github.com/mono/monodevelop/blob/master/extras/MonoDevelop.Database/MonoDevelop.Database.Sql/Providers/IGuiProvider.cs
    [5] https://github.com/mono/monodevelop/blob/master/extras/MonoDevelop.Database/MonoDevelop.Database.Sql/ConnectionPool/AbstractPooledDbConnection.cs
    [6] https://github.com/mono/monodevelop/blob/master/extras/MonoDevelop.Database/MonoDevelop.Database.Sql/Providers/AbstractSchemaProvider.cs
    [7] https://github.com/mono/monodevelop/blob/master/extras/MonoDevelop.Database/MonoDevelop.Database.Sql/IDbLinq.cs
    [8] https://github.com/mono/monodevelop/blob/master/extras/MonoDevelop.Database/MonoDevelop.Database.Sql/Dialect/ISqlDialect.cs