Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8386823
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T18:02:53+00:00 2026-06-09T18:02:53+00:00

I am trying to use Sqlite as a memory database with ServiceStack ORMlite in

  • 0

I am trying to use Sqlite as a memory database with ServiceStack ORMlite in my unit tests.

If I run my tests with SQLite saving to a file, ie. using the connectionstring

"Data Source=|DataDirectory|unittest.db;Version=3;"

, it works fine and auth tables are generated fine by ServiceStacks

userRepository.CreateMissingTables(); 

However, when I try using SQLite as a memory database by using this connectionstring

":memory:"

I get an exception when saying

SQLite error
no such table: UserAuth

the first time I try to fetch a user by doing this

userRepository.GetUserAuthByUserName(...)

This is after I have called userRepository.CreateMissingTables() and it works fine if I switch to using SQLite with a file database. Does anybody know what the problem could be? (I had to down grade to version 3.9.0 of ORMLite because of bad references to version 1.0.65.0 of ORM lite in Ormlite 3.9.4)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T18:02:55+00:00Added an answer on June 9, 2026 at 6:02 pm

    ServiceStack v5

    Recent versions of ServiceStack automatically disables AutoDisposeConnection for SQLite :memory: connections, so you can configure your OrmLiteConnectionFactory normally, e.g:

    var dbFactory = new OrmLiteConnectionFactory(":memory:", SqliteDialect.Provider);
    
    var sqliteRepo = new OrmLiteAuthRepository(dbFactory);
    sqliteRepo.CreateMissingTables();
    

    ServiceStack v3

    You lose your database whenever you close the DB connection of an Sqlite in memory database.

    So when you configure your DB Factory you need to tell it to never dispose of the connection, which you can do with the autoDisposeConnection constructor param, e.g:

    var dbFactory = new OrmLiteConnectionFactory(":memory:", 
        autoDisposeConnection:false, 
        dialectProvider:SqliteDialect.Provider);
    
    var sqliteRepo = new OrmLiteAuthRepository(dbFactory);
    sqliteRepo.CreateMissingTables();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to use an in-memory SQLite database to test my data layer which
I'm trying to use an SQLite database to store some data for my app.
I was trying to use SQLite database using ADO.NET Entity Framework 5 and I
I'm trying to use System.Data.Sqlite library, and I'm following the documentation about optimizing inserts
I'm trying to use Induction to connect to my local SQLite database however I've
I'm trying to use sqlite in a 'data services' class like below. I keep
Im trying to use an sqlite database in xcode 4.2 and ios5 sdk. The
To speed up the unit tests I want to use SQLite instead of MySQL,
I'm trying to use an offline MBTiles database using Route-Me . To accomplish this,
I'm trying to use SQLite's C API to open a database and access some

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.