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

SQLite App.config

7 Answers 1531 Views
Getting Started
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Erik
Top achievements
Rank 1
Erik asked on 25 Jun 2012, 01:29 PM
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?

7 Answers, 1 is accepted

Sort by
0
Zoran
Telerik team
answered on 27 Jun 2012, 02:25 PM
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.
0
Keith
Top achievements
Rank 2
answered on 07 Mar 2014, 02:24 PM
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! 
0
Boris Georgiev
Telerik team
answered on 11 Mar 2014, 05:47 PM
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.
0
Keith
Top achievements
Rank 2
answered on 12 Mar 2014, 02:27 PM
@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.


0
Keith
Top achievements
Rank 2
answered on 13 Mar 2014, 02:14 PM
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.
0
Kristian Nikolov
Telerik team
answered on 14 Mar 2014, 08:07 AM
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.
 
0
Keith
Top achievements
Rank 2
answered on 14 Mar 2014, 11:58 AM
Thanks! That worked perfectly.
Tags
Getting Started
Asked by
Erik
Top achievements
Rank 1
Answers by
Zoran
Telerik team
Keith
Top achievements
Rank 2
Boris Georgiev
Telerik team
Kristian Nikolov
Telerik team
Share this question
or