2

I'm developing a C# program which uses LiteDB to store data. During the design phase I was told it will be a single-user application, so LiteDB seemed like a pretty good solution. I had no experience with LiteDB before.

However recently I've been informed that the program needs to support multiple users accessing and writing to the same database over the computer network. I know that LiteDB was not designed to be used this way so obvious decision would be to switch to any other server-based DBMS like MySQL.

Now I know that LiteDB supports concurrent access so I've evaluated all the operations with the database in my program. These operations are not continuous and do not require constant access to the database.

My first question is will the following be possible with LiteDB:

  1. Up to 20 instances of the program are accessing the database file over the network roughly at the same time and recevieve the data. After receiving the data, database connection closes. No changes to the database are made.
  2. Up to 20 instances of the program are accessing the database file over the network roughly at the same time and commit changes. After writing the data, database connection closes. No reading any data from the database.

I want to know if at least any of these two options is possible. And if not, what should I use as an alternative? I work at a company so this could be interpretated as a commercial usage which limits the range of DBMS I can use.

LiteDB is extremely attractive to me because it makes very easy to store the data, which is in my case are instance of classes which include other class instances as properties.

The best alternative would be a portable database server with easy to setup and minimal functions which supports concurrent access.

Technical
  • 145
  • 1
  • 11
  • You could see how much work it would be to convert the database to SQLite, which does support multiple concurrent users, or even better SQL Server. The next best option would be to write a services layer that could queue/serialize database requests to your LiteDB to handle them one at a time. Have your app then interact with the service layer, instead of connecting directly to LiteDB – Jon Apr 19 '19 at 13:15
  • 1
    @Jon , I worked with System.Data.SQLite and it was a mess. My apps refused to run on anything below Windows 10. Constant x86 and x64 compatibility issues. I have no experience with developing services or networking and my deadline is near, so it's out of question. Guess I'll have to stick to a portable database server. – Technical Apr 19 '19 at 13:32
  • have you considered SQL Server LocalDB? It is portable and very easy to work with from .NET – Jon Apr 19 '19 at 13:36
  • @Jon Recently I've been thinking about creating an ASP.NET WebAPI application for retrieving and saving data over HTTP instead of using DBMS. This way I still can use LiteDB. Do you think this would be a good solution? – Technical Apr 21 '19 at 16:07
  • That’s a great idea – Jon Apr 21 '19 at 16:51

0 Answers0