Can I send Database between users? - c#

I have a WPF app. I need to do something so that users can share their databases localy (without internet). For example: "User-1 launch the app and adding some information to DB, after that user-1 downloads his DB to USB and gives it to user-2. User-2 succesfuly put DB from user-1 USB and easily launchs it with the same app on his PC". Can this be achived with EF/EF Core? Or what i need to use to achive that?

Though it sounds as a very bad practice, but maybe you have good reasons for this.
You could use LocalDB, which is an very small sql package which can read directly from the .mdf database file without having to 'setup a sql server';
https://learn.microsoft.com/en-us/sql/database-engine/configure-windows/sql-server-express-localdb?view=sql-server-2017
Or like the user CodeCaster mentioned, use SQLLite. Which also reads and saves to a file locally;
https://www.sqlitetutorial.net/sqlite-tutorial/sqlite-export-csv/

Entity Framework is a database-agnostic data access library. This means that it doesn't care where your database lives.
If you want a portable database, look into SQLite.

Related

How do I create a database that's already included in to the project - C#

Is that possible to create a database that's already included in the project and without opening the database application?
Because, I have to publish the system that I made.
I think that you might be interested by in-memory databases, It is treated here.
You could also have a remote database, giving the capacity to anyone with your application and appropriate credentials to connect to it.
If you are looking for a other alternative, you could also export the Scheme and/or Data of a database to a portable .sql file.

Create a localDB and use it when SQL server is down

I need your help to manage an issue with my C# program. I wrote a GUI that allows the user to manage a lot of data stored in a SQL Server database. Everything works fine but I want to be sure that the application works even when the server is down (for a generic issue).
My plan is to have a local database (e.g. *.mdf database used in Visual Studio) and update it every time the GUI is able to connect to the online SQL Server database.
What do you think? Is there something similar to a procedure or do I need to do it manually (create a .mdf file, check the online version, write the changes etc.)?
Apart from the comments noting that this may not be a good idea (which I agree):
Most of the work must be done manually. If you have a DB model within your application (like when using entity framework) it could be that it can create the DB structure in the local file. Most of your data will need timestamps to determine when they were changed the last time.
The Microsoft Sync Framework might utilize you but I have not used it personally. Look here http://msdn.microsoft.com/en-us/library/bb902854(v=sql.110).aspx

Store relational data in single proprietary file

In my application programming experience, I have always worked with a SQL Server (or Access) database on the back end that stores application data. I'm now looking at some business requirements that work with data that would fit well in a relational database, but they require it to be stored in a single, portable, custom file that the application will create, and load from. I know it's a very common concept for an application to save off a single file or document that it can later load and continue to work on, but I'm not sure how to achieve this with complex data. Encrypting xml comes to mind, but that would be very slow to work with or potentially eat up a lot of memory if I had to load it all back into objects first. What are some options?
I recommend you use a SQLLite or Firebird embedded database. There are other options as well. They support single-file usage and will give you a clear upgrade path for future versions of you schema (upgrade SQL scripts).
I did not understand how encryption plays into this.
When running in a .NET environment I think that SQL Server Compact is worth looking into. It is basically a mini SQL Server that doesn't have to be installed and configured as a service, but instead is an dll that you reference. You can use normal data access tools like linq-to-sql and entity framework.
SQLite comes to my mind. Its a single file based DB. Here is a link to convert SQL server databases to SQLite. Also check out Using SQLite in your C# Application

What database can I use that does not need an application to be installed

Hi I am creating a windows application and I need to select a database. I dont want to go out and install sql server express for every person who uses my application.
What database can I use that does not need an application to be installed. I would like to have a database for each customer that is stored locally.
I use SQLite (http://www.sqlite.org/). It's free and you just have to distribute a dll
It allows you to manage up to 14 terabytes sized DBs (http://www.sqlite.org/limits.html)
It would depend on what you wanted to use it for, if you just want one database for each user then I would look at using SQLite
If you need one database for every user that SQL server installed on a remote server would be ideal
SQLite rocks in these scenarios.
Use either SQLite or SQL Server Compact Edition
I'd think of using SQLite. It is serverless and requires no preconfiguration on the users part. Each database is simply kept as a single file. Read this SQLite
I think its better to use : SQL Light database might resolve your problem.
Limits In SQLite

Best means to store data locally when offline

I am in the midst of writing a small program (more to experiment with vs 2010 than anything else)
Despite being an experiment it has some practical use for our local athletics club.
My thought was to access the DB (currently online) to download the current members and store locally on a laptop (this is a MS sql table, used to power the club's website).
Take the laptop to the event (yes there ARE places that don't have internet coverage), add members to that days race (also a row from a sql table (though no changes would be made to this), record results (new records in 3rd table)
Once home, showered and within internet access again, upload/edit the tables as per the race results/member changes etc.
So I was thinking I'd do something like write xml files locally with the data, including a field to indicate changes etc?
If anyone can point me in a direction I would appreciate it...hell if anyone could tell me if this has a name, I'd appreciate it.
Essentially what you need is, in addition to your remote data store, a local data store on your desktop. You could then write your code by hand to sync the data stores when you go offline / online, or you could use the Microsoft Sync framework to handle it for you.
I've personally used the Sync framework on a number of projects and once you get used to the conventions, it's pretty easy to use.
If a local storage format is what your after. SQLite is one option. You can copy your tables from the server to your local SQLite db.
You could also save your data to files, but XML is a horrible format for doing this. You'll probably want to use YAML or JSON instead.
You may want to take a look at SQL Server Compact -- it provides some decent capabilities with synchronizing back with the mothership SQL server.
If you're using MS SQL Server for production, and you only need to work offline on your personal computer, you could install MS SQL Server Express locally. The advantage here over using a different local datastore is that you can reuse your schema, stored procedures, etc. essentially only needing to change the connection string to your application (which you could run locally too through Visual Studio). You would have to write code to manually sync your online and offline db instances, but since it's a small application, it may be reasonable to just copy the entire database from production to local and then from local to production when you get home (assuming you're the only one updating the db, and wouldn't be potentially wiping out any new records entered in production while you were at the event).
Google Gears http://gears.google.com/ is intended if your app is a web app (which I didn't quite get what it is from your description)

Categories

Resources