SQLite App.config

8 posts, 0 answers
  1. Erik
    Erik avatar
    36 posts
    Member since:
    Jun 2012

    Posted 25 Jun 2012 Link to this post

    I'm just starting out with OpenAccess ORM, and I want to use Fluent mapping in combination with SQLite. I've installed the adapter from http://system.data.sqlite.org.
    What should I put as the connection string in my App.config?
  2. Zoran
    Admin
    Zoran avatar
    534 posts

    Posted 27 Jun 2012 Link to this post

    Hi Erik,

     The connection string for SQLite only requires the name of the database file set in the Data Source parameter of the connection string. So your connection strings section could look something like this:

    <connectionStrings>
        <add name="YourConnection"
             connectionString="data source=|DataDirectory|YourDB.sqlite"
             providerName="System.Data.SqlLite"/>
    </connectionStrings>

    You can check several more connection string options for the SQLite backend.Kind regards,
    Zoran
    the Telerik team
    OpenAccess ORM Q2'12 Now Available! Get your hands on all the new stuff.
  3. DevCraft banner
  4. Keith
    Keith avatar
    22 posts
    Member since:
    Sep 2010

    Posted 07 Mar 2014 Link to this post

    I am also trying to start working with Telerik Data Access and SQLite. I have followed the steps for creating a Telerik Data Access Class Library, added the System.Data.SQLite nuget package, created a blank db.sqlite file to hold the database, and added the following connection string to the App.config file within the class library.

    <connectionStrings>
        <add name="DBSQLite" connectionString="data source=.\db.sqlite" providerName="System.Data.SQLite"/>
      </connectionStrings>

    I have also created an EntitiesModel.rlinq file with a single Domain Class and I have mapped this to a table using the default mappings option. I then right click on the rlinq designer surface and choose "Update database from model" and click the Add New Connection button at which point I receive an error stating "No data sources are available". I am also not able to select an existing data source from the drop down.

    Any help would be greatly appreciated! 
  5. Boris Georgiev
    Admin
    Boris Georgiev avatar
    190 posts

    Posted 11 Mar 2014 Link to this post

    Hi Keith,

    If you want to be able to create a connection to SQLite database via "Setup Database Connection" wizard you should have installed ADO.NET provider for SQLite. You can download the provider from this page. Adding the SQLite nuget package can help, if you want to deploy the application on the server where the provider is not installed. But for Development environment you need the ADO.NET provider installed and then you will be able to select a data source from the "Setup Database Connection" wizard.

    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.
  6. Keith
    Keith avatar
    22 posts
    Member since:
    Sep 2010

    Posted 12 Mar 2014 in reply to Boris Georgiev Link to this post

    @Boris - Thanks for the info but I have already installed this provider. I am currently running Windows 7 Pro (x64) and I have tried installing the following System.Data.SqlLite providers:

    • sqlite-netFx451-setup-bundle-x86-2013-1.0.91.0.exe
    • sqlite-netFx451-setup-bundle-x64-2013-1.0.91.0.exe

    Neither of these options seems to have made a difference.


  7. Keith
    Keith avatar
    22 posts
    Member since:
    Sep 2010

    Posted 13 Mar 2014 in reply to Keith Link to this post

    Ok... so I reinstalled both Telerik OpenAccess and the System.Data.SqlLite provider. I am now able to create and access SqlLite databases! However, I am running into a new problem in that I cannot seem to get the primary keys on my tables to autoincrement when working in the model first workflow. I thought that this would be the default behavior but it does not seem to be working. Is there some specific configuration option that I need to set? I read through the SqlLite documentation on the OpenAccess documentation portal but I couldn't find anything about this issue.
  8. Kristian Nikolov
    Admin
    Kristian Nikolov avatar
    206 posts

    Posted 14 Mar 2014 Link to this post

    Hi Keith,

    We are glad you have resolved your connection issue.

    Regarding the auto incrementing primary keys - the behavior you are experiencing is normal. By default when creating a model the identity mechanism is not set to database calculated and therefore the primary keys are not auto incremented

    You can alter this behavior by selecting DatabaseServerCalculated for the Identity Mechanism property value of your domain classes. This article describes the process of doing so in detail.

    I hope this helps. Should you have additional questions, feel free to post in our forums again.

    Regards,
    Kristian Nikolov
    Telerik
     
    OpenAccess ORM is now Telerik Data Access. For more information on the new names, please, check out the Telerik Product Map.
     
  9. Keith
    Keith avatar
    22 posts
    Member since:
    Sep 2010

    Posted 14 Mar 2014 in reply to Kristian Nikolov Link to this post

    Thanks! That worked perfectly.
Back to Top
DevCraft banner